Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript complaints about logger definition #102

Open
rpinto-immfly opened this issue Jul 25, 2024 · 2 comments
Open

Typescript complaints about logger definition #102

rpinto-immfly opened this issue Jul 25, 2024 · 2 comments

Comments

@rpinto-immfly
Copy link

Just by using the simplest example, typescript complaints about the private properties:

  logger,
  consoleTransport,
  fileAsyncTransport,
  configLoggerType,
} from 'react-native-logs'
import * as FileSystem from 'expo-file-system'

const config: configLoggerType = {
  transport: __DEV__ ? consoleTransport : fileAsyncTransport,
  severity: __DEV__ ? 'debug' : 'error',
  transportOptions: {
    colors: {
      info: 'blueBright',
      warn: 'yellowBright',
      error: 'redBright',
    },
    FS: FileSystem,
  },
}

const log = logger.createLogger(config)

export { log }```

Property '_async' of exported class expression may not be private or protected.ts(4094)
Property '_asyncFunc' of exported class expression may not be private or protected.ts(4094)
Property '_dateFormat' of exported class expression may not be private or protected.ts(4094)
Property '_disabledExtensions' of exported class expression may not be private or protected.ts(4094)
Property '_enabled' of exported class expression may not be private or protected.ts(4094)
Property '_enabledExtensions' of exported class expression may not be private or protected.ts(4094)
Property '_extendedLogs' of exported class expression may not be private or protected.ts(4094)
Property '_extensions' of exported class expression may not be private or protected.ts(4094)
Property '_fixedExtLvlLength' of exported class expression may not be private or protected.ts(4094)
Property '_formatFunc' of exported class expression may not be private or protected.ts(4094)
Property '_formatMsg' of exported class expression may not be private or protected.ts(4094)
Property '_isExtensionEnabled' of exported class expression may not be private or protected.ts(4094)
Property '_isLevelEnabled' of exported class expression may not be private or protected.ts(4094)
Property '_level' of exported class expression may not be private or protected.ts(4094)
Property '_levels' of exported class expression may not be private or protected.ts(4094)
Property '_log' of exported class expression may not be private or protected.ts(4094)
Property '_maxExtensionsChars' of exported class expression may not be private or protected.ts(4094)
Property '_maxLevelsChars' of exported class expression may not be private or protected.ts(4094)
Property '_originalConsole' of exported class expression may not be private or protected.ts(4094)
Property '_printDate' of exported class expression may not be private or protected.ts(4094)
Property '_printLevel' of exported class expression may not be private or protected.ts(4094)
Property '_sendToTransport' of exported class expression may not be private or protected.ts(4094)
Property '_stringifyFunc' of exported class expression may not be private or protected.ts(4094)
Property '_stringifyMsg' of exported class expression may not be private or protected.ts(4094)
Property '_transport' of exported class expression may not be private or protected.ts(4094)
Property '_transportOptions' of exported class expression may not be private or protected.ts(4094)
const log: Omit<logs, "extend"> & {
    [x: string]: (...args: unknown[]) => void;
} & {
    extend: (extension: string) => { [key in string]: (...args: unknown[]) => void; };
}
@jp-amz
Copy link

jp-amz commented Jul 25, 2024

Try a .js instead

@andhikaalgo
Copy link

andhikaalgo commented Dec 19, 2024

const defaultConfig: configLoggerType<
transportFunctionType[],
'info' | 'warn' | 'error' | 'debug'
> = {
levels: {
debug: 0,
info: 1,
warn: 2,
error: 3,
},
severity: !DEV ? 'debug' : 'error',
transport: DEV
? [consoleTransport]
: [fileAsyncTransport, sentryTransport],
transportOptions: {
colors: {
info: 'blueBright',
warn: 'yellowBright',
error: 'redBright',
},
FS: RNFS,
SENTRY: Sentry,
fileName: log.txt,
errorLevels: null,
},
dateFormat: 'time',
printLevel: true,
printDate: true,
enabled: true,
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants