standard-log 8.0.1 → 9.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -133
- package/{esm/console/createConsoleLogReporter.d.ts → cjs/console.d.ts} +5 -5
- package/cjs/console.d.ts.map +1 -0
- package/cjs/console.js +74 -0
- package/cjs/console.js.map +1 -0
- package/cjs/console.spec.d.ts +2 -0
- package/cjs/console.spec.d.ts.map +1 -0
- package/cjs/{console/createConsoleLogReporter.spec.js → console.spec.js} +50 -68
- package/cjs/console.spec.js.map +1 -0
- package/cjs/errors.d.ts +0 -10
- package/cjs/errors.d.ts.map +1 -1
- package/cjs/errors.js +1 -43
- package/cjs/errors.js.map +1 -1
- package/cjs/formatter.d.ts +6 -0
- package/cjs/formatter.d.ts.map +1 -0
- package/cjs/formatter.js +46 -0
- package/cjs/formatter.js.map +1 -0
- package/cjs/formatter.spec.d.ts +2 -0
- package/cjs/formatter.spec.d.ts.map +1 -0
- package/cjs/formatter.spec.js +32 -0
- package/cjs/formatter.spec.js.map +1 -0
- package/cjs/global.d.ts +13 -0
- package/cjs/global.d.ts.map +1 -0
- package/cjs/global.js +33 -0
- package/cjs/global.js.map +1 -0
- package/cjs/global.spec.d.ts +2 -0
- package/cjs/global.spec.d.ts.map +1 -0
- package/cjs/global.spec.js +32 -0
- package/cjs/global.spec.js.map +1 -0
- package/cjs/index.d.ts +6 -14
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +11 -14
- package/cjs/index.js.map +1 -1
- package/cjs/logLevels.d.ts +60 -0
- package/cjs/logLevels.d.ts.map +1 -0
- package/cjs/logLevels.js +87 -0
- package/cjs/logLevels.js.map +1 -0
- package/cjs/logStore.d.ts +20 -0
- package/cjs/logStore.d.ts.map +1 -0
- package/cjs/logStore.js +44 -0
- package/cjs/logStore.js.map +1 -0
- package/cjs/logStore.spec.d.ts +2 -0
- package/cjs/logStore.spec.d.ts.map +1 -0
- package/cjs/logStore.spec.js +93 -0
- package/cjs/logStore.spec.js.map +1 -0
- package/cjs/logger.d.ts +5 -0
- package/cjs/logger.d.ts.map +1 -0
- package/cjs/logger.js +99 -0
- package/cjs/logger.js.map +1 -0
- package/{esm/memory/MemoryLogReporter.d.ts → cjs/memory.d.ts} +2 -2
- package/cjs/memory.d.ts.map +1 -0
- package/cjs/memory.js +39 -0
- package/cjs/memory.js.map +1 -0
- package/cjs/memory.spec.d.ts +2 -0
- package/cjs/memory.spec.d.ts.map +1 -0
- package/cjs/memory.spec.js +115 -0
- package/cjs/memory.spec.js.map +1 -0
- package/cjs/package.json +1 -3
- package/cjs/platform.browser.d.ts +6 -0
- package/cjs/platform.browser.d.ts.map +1 -0
- package/cjs/platform.browser.js +7 -0
- package/cjs/platform.browser.js.map +1 -0
- package/cjs/platform.d.ts +6 -0
- package/cjs/platform.d.ts.map +1 -0
- package/cjs/platform.js +9 -0
- package/cjs/platform.js.map +1 -0
- package/cjs/standardLog.d.ts +28 -0
- package/cjs/standardLog.d.ts.map +1 -0
- package/cjs/standardLog.js +65 -0
- package/cjs/standardLog.js.map +1 -0
- package/cjs/standardLog.spec.d.ts +2 -0
- package/cjs/standardLog.spec.d.ts.map +1 -0
- package/cjs/standardLog.spec.js +548 -0
- package/cjs/standardLog.spec.js.map +1 -0
- package/cjs/testUtil.d.ts +7 -5
- package/cjs/testUtil.d.ts.map +1 -1
- package/cjs/testUtil.js +11 -14
- package/cjs/testUtil.js.map +1 -1
- package/cjs/types.d.ts +33 -24
- package/cjs/types.d.ts.map +1 -1
- package/cjs/types.js.map +1 -1
- package/dist/standard-log.es5.js +355 -1071
- package/dist/standard-log.es5.js.gz +0 -0
- package/dist/standard-log.es5.js.map +1 -1
- package/dist/standard-log.es5.js.map.gz +0 -0
- package/dist/standard-log.esm.js +353 -1135
- package/dist/standard-log.esm.js.gz +0 -0
- package/dist/standard-log.esm.js.map +1 -1
- package/dist/standard-log.esm.js.map.gz +0 -0
- package/{cjs/console/createConsoleLogReporter.d.ts → esm/console.d.ts} +5 -5
- package/esm/console.d.ts.map +1 -0
- package/esm/console.js +62 -0
- package/esm/console.js.map +1 -0
- package/esm/console.spec.d.ts +2 -0
- package/esm/console.spec.d.ts.map +1 -0
- package/esm/{console/createConsoleLogReporter.spec.js → console.spec.js} +50 -65
- package/esm/console.spec.js.map +1 -0
- package/esm/errors.d.ts +0 -10
- package/esm/errors.d.ts.map +1 -1
- package/esm/errors.js +0 -34
- package/esm/errors.js.map +1 -1
- package/esm/formatter.d.ts +6 -0
- package/esm/formatter.d.ts.map +1 -0
- package/esm/{formatter/createTimestampFormatter.js → formatter.js} +10 -2
- package/esm/formatter.js.map +1 -0
- package/esm/formatter.spec.d.ts +2 -0
- package/esm/formatter.spec.d.ts.map +1 -0
- package/esm/formatter.spec.js +30 -0
- package/esm/formatter.spec.js.map +1 -0
- package/esm/global.d.ts +13 -0
- package/esm/global.d.ts.map +1 -0
- package/esm/global.js +28 -0
- package/esm/global.js.map +1 -0
- package/esm/global.spec.d.ts +2 -0
- package/esm/global.spec.d.ts.map +1 -0
- package/esm/global.spec.js +30 -0
- package/esm/global.spec.js.map +1 -0
- package/esm/index.d.ts +6 -14
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +6 -14
- package/esm/index.js.map +1 -1
- package/esm/logLevels.d.ts +60 -0
- package/esm/logLevels.d.ts.map +1 -0
- package/esm/{logLevel.js → logLevels.js} +29 -3
- package/esm/logLevels.js.map +1 -0
- package/esm/logStore.d.ts +20 -0
- package/esm/logStore.d.ts.map +1 -0
- package/esm/logStore.js +37 -0
- package/esm/logStore.js.map +1 -0
- package/esm/logStore.spec.d.ts +2 -0
- package/esm/logStore.spec.d.ts.map +1 -0
- package/esm/logStore.spec.js +93 -0
- package/esm/logStore.spec.js.map +1 -0
- package/esm/logger.d.ts +5 -0
- package/esm/logger.d.ts.map +1 -0
- package/esm/logger.js +75 -0
- package/esm/logger.js.map +1 -0
- package/{cjs/memory/MemoryLogReporter.d.ts → esm/memory.d.ts} +2 -2
- package/esm/memory.d.ts.map +1 -0
- package/esm/memory.js +34 -0
- package/esm/memory.js.map +1 -0
- package/esm/memory.spec.d.ts +2 -0
- package/esm/memory.spec.d.ts.map +1 -0
- package/esm/memory.spec.js +110 -0
- package/esm/memory.spec.js.map +1 -0
- package/esm/platform.browser.d.ts +6 -0
- package/esm/platform.browser.d.ts.map +1 -0
- package/esm/platform.browser.js +3 -0
- package/esm/platform.browser.js.map +1 -0
- package/esm/platform.d.ts +6 -0
- package/esm/platform.d.ts.map +1 -0
- package/esm/platform.js +5 -0
- package/esm/platform.js.map +1 -0
- package/esm/standardLog.d.ts +28 -0
- package/esm/standardLog.d.ts.map +1 -0
- package/esm/standardLog.js +41 -0
- package/esm/standardLog.js.map +1 -0
- package/esm/standardLog.spec.d.ts +2 -0
- package/esm/standardLog.spec.d.ts.map +1 -0
- package/esm/standardLog.spec.js +446 -0
- package/esm/standardLog.spec.js.map +1 -0
- package/esm/testUtil.d.ts +7 -5
- package/esm/testUtil.d.ts.map +1 -1
- package/esm/testUtil.js +8 -12
- package/esm/testUtil.js.map +1 -1
- package/esm/types.d.ts +33 -24
- package/esm/types.d.ts.map +1 -1
- package/esm/types.js.map +1 -1
- package/package.json +10 -19
- package/ts/console.ts +70 -0
- package/ts/errors.ts +0 -12
- package/ts/{formatter/createTimestampFormatter.ts → formatter.ts} +12 -1
- package/ts/global.ts +34 -0
- package/ts/index.ts +9 -14
- package/ts/{logLevel.ts → logLevels.ts} +20 -3
- package/ts/logStore.ts +52 -0
- package/ts/logger.ts +85 -0
- package/ts/memory.ts +47 -0
- package/ts/platform.browser.ts +5 -0
- package/ts/platform.ts +8 -0
- package/ts/standardLog.ts +65 -0
- package/ts/types.ts +39 -30
- package/cjs/LogEntry.d.ts +0 -7
- package/cjs/LogEntry.d.ts.map +0 -1
- package/cjs/LogEntry.js +0 -3
- package/cjs/LogEntry.js.map +0 -1
- package/cjs/captureLogs.d.ts +0 -4
- package/cjs/captureLogs.d.ts.map +0 -1
- package/cjs/captureLogs.js +0 -33
- package/cjs/captureLogs.js.map +0 -1
- package/cjs/captureLogs.spec.d.ts +0 -2
- package/cjs/captureLogs.spec.d.ts.map +0 -1
- package/cjs/captureLogs.spec.js +0 -117
- package/cjs/captureLogs.spec.js.map +0 -1
- package/cjs/config.d.ts +0 -12
- package/cjs/config.d.ts.map +0 -1
- package/cjs/config.js +0 -59
- package/cjs/config.js.map +0 -1
- package/cjs/config.spec.d.ts +0 -2
- package/cjs/config.spec.d.ts.map +0 -1
- package/cjs/config.spec.js +0 -72
- package/cjs/config.spec.js.map +0 -1
- package/cjs/configForTest.d.ts +0 -5
- package/cjs/configForTest.d.ts.map +0 -1
- package/cjs/configForTest.js +0 -18
- package/cjs/configForTest.js.map +0 -1
- package/cjs/configForTest.spec.d.ts +0 -2
- package/cjs/configForTest.spec.d.ts.map +0 -1
- package/cjs/configForTest.spec.js +0 -17
- package/cjs/configForTest.spec.js.map +0 -1
- package/cjs/console/createConsoleLogReporter.d.ts.map +0 -1
- package/cjs/console/createConsoleLogReporter.js +0 -42
- package/cjs/console/createConsoleLogReporter.js.map +0 -1
- package/cjs/console/createConsoleLogReporter.spec.d.ts +0 -2
- package/cjs/console/createConsoleLogReporter.spec.d.ts.map +0 -1
- package/cjs/console/createConsoleLogReporter.spec.js.map +0 -1
- package/cjs/console/index.d.ts +0 -4
- package/cjs/console/index.d.ts.map +0 -1
- package/cjs/console/index.js +0 -20
- package/cjs/console/index.js.map +0 -1
- package/cjs/console/isConsoleDebugAvailable.d.ts +0 -2
- package/cjs/console/isConsoleDebugAvailable.d.ts.map +0 -1
- package/cjs/console/isConsoleDebugAvailable.js +0 -20
- package/cjs/console/isConsoleDebugAvailable.js.map +0 -1
- package/cjs/console/polyfilledConsole.d.ts +0 -7
- package/cjs/console/polyfilledConsole.d.ts.map +0 -1
- package/cjs/console/polyfilledConsole.js +0 -41
- package/cjs/console/polyfilledConsole.js.map +0 -1
- package/cjs/console/semverGt.d.ts +0 -2
- package/cjs/console/semverGt.d.ts.map +0 -1
- package/cjs/console/semverGt.js +0 -13
- package/cjs/console/semverGt.js.map +0 -1
- package/cjs/console/semverGt.spec.d.ts +0 -2
- package/cjs/console/semverGt.spec.d.ts.map +0 -1
- package/cjs/console/semverGt.spec.js +0 -22
- package/cjs/console/semverGt.spec.js.map +0 -1
- package/cjs/console/toConsoleMethod.d.ts +0 -2
- package/cjs/console/toConsoleMethod.d.ts.map +0 -1
- package/cjs/console/toConsoleMethod.js +0 -22
- package/cjs/console/toConsoleMethod.js.map +0 -1
- package/cjs/console/types.d.ts +0 -3
- package/cjs/console/types.d.ts.map +0 -1
- package/cjs/console/types.js +0 -3
- package/cjs/console/types.js.map +0 -1
- package/cjs/customLogLevel.d.ts +0 -11
- package/cjs/customLogLevel.d.ts.map +0 -1
- package/cjs/customLogLevel.js +0 -38
- package/cjs/customLogLevel.js.map +0 -1
- package/cjs/customLogLevel.spec.d.ts +0 -2
- package/cjs/customLogLevel.spec.d.ts.map +0 -1
- package/cjs/customLogLevel.spec.js +0 -37
- package/cjs/customLogLevel.spec.js.map +0 -1
- package/cjs/formatter/createTimestampFormatter.d.ts +0 -3
- package/cjs/formatter/createTimestampFormatter.d.ts.map +0 -1
- package/cjs/formatter/createTimestampFormatter.js +0 -26
- package/cjs/formatter/createTimestampFormatter.js.map +0 -1
- package/cjs/formatter/createTimestampFormatter.spec.d.ts +0 -2
- package/cjs/formatter/createTimestampFormatter.spec.d.ts.map +0 -1
- package/cjs/formatter/createTimestampFormatter.spec.js +0 -23
- package/cjs/formatter/createTimestampFormatter.spec.js.map +0 -1
- package/cjs/formatter/formatLogLevel.d.ts +0 -2
- package/cjs/formatter/formatLogLevel.d.ts.map +0 -1
- package/cjs/formatter/formatLogLevel.js +0 -10
- package/cjs/formatter/formatLogLevel.js.map +0 -1
- package/cjs/formatter/index.d.ts +0 -4
- package/cjs/formatter/index.d.ts.map +0 -1
- package/cjs/formatter/index.js +0 -20
- package/cjs/formatter/index.js.map +0 -1
- package/cjs/formatter/plainLogFormatter.d.ts +0 -3
- package/cjs/formatter/plainLogFormatter.d.ts.map +0 -1
- package/cjs/formatter/plainLogFormatter.js +0 -19
- package/cjs/formatter/plainLogFormatter.js.map +0 -1
- package/cjs/formatter/plainLogFormatter.spec.d.ts +0 -2
- package/cjs/formatter/plainLogFormatter.spec.d.ts.map +0 -1
- package/cjs/formatter/plainLogFormatter.spec.js +0 -9
- package/cjs/formatter/plainLogFormatter.spec.js.map +0 -1
- package/cjs/getDefaultReporter.browser.d.ts +0 -2
- package/cjs/getDefaultReporter.browser.d.ts.map +0 -1
- package/cjs/getDefaultReporter.browser.js +0 -15
- package/cjs/getDefaultReporter.browser.js.map +0 -1
- package/cjs/getDefaultReporter.d.ts +0 -2
- package/cjs/getDefaultReporter.d.ts.map +0 -1
- package/cjs/getDefaultReporter.js +0 -19
- package/cjs/getDefaultReporter.js.map +0 -1
- package/cjs/getLogModeFromEnvironment.browser.d.ts +0 -3
- package/cjs/getLogModeFromEnvironment.browser.d.ts.map +0 -1
- package/cjs/getLogModeFromEnvironment.browser.js +0 -9
- package/cjs/getLogModeFromEnvironment.browser.js.map +0 -1
- package/cjs/getLogModeFromEnvironment.d.ts +0 -3
- package/cjs/getLogModeFromEnvironment.d.ts.map +0 -1
- package/cjs/getLogModeFromEnvironment.js +0 -17
- package/cjs/getLogModeFromEnvironment.js.map +0 -1
- package/cjs/getLogModeFromEnvironment.spec.d.ts +0 -2
- package/cjs/getLogModeFromEnvironment.spec.d.ts.map +0 -1
- package/cjs/getLogModeFromEnvironment.spec.js +0 -25
- package/cjs/getLogModeFromEnvironment.spec.js.map +0 -1
- package/cjs/getLogger.d.ts +0 -9
- package/cjs/getLogger.d.ts.map +0 -1
- package/cjs/getLogger.js +0 -103
- package/cjs/getLogger.js.map +0 -1
- package/cjs/getLogger.spec.d.ts +0 -2
- package/cjs/getLogger.spec.d.ts.map +0 -1
- package/cjs/getLogger.spec.js +0 -485
- package/cjs/getLogger.spec.js.map +0 -1
- package/cjs/getLoggers.d.ts +0 -7
- package/cjs/getLoggers.d.ts.map +0 -1
- package/cjs/getLoggers.js +0 -15
- package/cjs/getLoggers.js.map +0 -1
- package/cjs/logLevel.d.ts +0 -106
- package/cjs/logLevel.d.ts.map +0 -1
- package/cjs/logLevel.js +0 -59
- package/cjs/logLevel.js.map +0 -1
- package/cjs/logLevel.spec.d.ts +0 -2
- package/cjs/logLevel.spec.d.ts.map +0 -1
- package/cjs/logLevel.spec.js +0 -195
- package/cjs/logLevel.spec.js.map +0 -1
- package/cjs/logLevelFn.d.ts +0 -20
- package/cjs/logLevelFn.d.ts.map +0 -1
- package/cjs/logLevelFn.js +0 -76
- package/cjs/logLevelFn.js.map +0 -1
- package/cjs/logReporter.d.ts +0 -7
- package/cjs/logReporter.d.ts.map +0 -1
- package/cjs/logReporter.js +0 -29
- package/cjs/logReporter.js.map +0 -1
- package/cjs/logReporter.spec.d.ts +0 -2
- package/cjs/logReporter.spec.d.ts.map +0 -1
- package/cjs/logReporter.spec.js +0 -98
- package/cjs/logReporter.spec.js.map +0 -1
- package/cjs/logReporterInternal.d.ts +0 -3
- package/cjs/logReporterInternal.d.ts.map +0 -1
- package/cjs/logReporterInternal.js +0 -23
- package/cjs/logReporterInternal.js.map +0 -1
- package/cjs/memory/MemoryLogReporter.d.ts.map +0 -1
- package/cjs/memory/MemoryLogReporter.js +0 -56
- package/cjs/memory/MemoryLogReporter.js.map +0 -1
- package/cjs/memory/MemoryLogReporter.spec.d.ts +0 -2
- package/cjs/memory/MemoryLogReporter.spec.d.ts.map +0 -1
- package/cjs/memory/MemoryLogReporter.spec.js +0 -124
- package/cjs/memory/MemoryLogReporter.spec.js.map +0 -1
- package/cjs/memory/index.d.ts +0 -3
- package/cjs/memory/index.d.ts.map +0 -1
- package/cjs/memory/index.js +0 -19
- package/cjs/memory/index.js.map +0 -1
- package/cjs/memory/logEntriesToString.d.ts +0 -3
- package/cjs/memory/logEntriesToString.d.ts.map +0 -1
- package/cjs/memory/logEntriesToString.js +0 -10
- package/cjs/memory/logEntriesToString.js.map +0 -1
- package/cjs/memory/logEntriesToString.spec.d.ts +0 -2
- package/cjs/memory/logEntriesToString.spec.d.ts.map +0 -1
- package/cjs/memory/logEntriesToString.spec.js +0 -36
- package/cjs/memory/logEntriesToString.spec.js.map +0 -1
- package/cjs/memory/toInspectStringForObject.d.ts +0 -3
- package/cjs/memory/toInspectStringForObject.d.ts.map +0 -1
- package/cjs/memory/toInspectStringForObject.js +0 -17
- package/cjs/memory/toInspectStringForObject.js.map +0 -1
- package/cjs/shouldLog.d.ts +0 -8
- package/cjs/shouldLog.d.ts.map +0 -1
- package/cjs/shouldLog.js +0 -14
- package/cjs/shouldLog.js.map +0 -1
- package/cjs/store.d.ts +0 -3
- package/cjs/store.d.ts.map +0 -1
- package/cjs/store.js +0 -27
- package/cjs/store.js.map +0 -1
- package/cjs/suppressLogs.d.ts +0 -6
- package/cjs/suppressLogs.d.ts.map +0 -1
- package/cjs/suppressLogs.js +0 -17
- package/cjs/suppressLogs.js.map +0 -1
- package/cjs/suppressLogs.spec.d.ts +0 -2
- package/cjs/suppressLogs.spec.d.ts.map +0 -1
- package/cjs/suppressLogs.spec.js +0 -31
- package/cjs/suppressLogs.spec.js.map +0 -1
- package/cjs/typesInternal.d.ts +0 -20
- package/cjs/typesInternal.d.ts.map +0 -1
- package/cjs/typesInternal.js +0 -3
- package/cjs/typesInternal.js.map +0 -1
- package/cjs/utils.d.ts +0 -6
- package/cjs/utils.d.ts.map +0 -1
- package/cjs/utils.js +0 -15
- package/cjs/utils.js.map +0 -1
- package/cjs/writeToReporters.d.ts +0 -6
- package/cjs/writeToReporters.d.ts.map +0 -1
- package/cjs/writeToReporters.js +0 -22
- package/cjs/writeToReporters.js.map +0 -1
- package/cjs/writeToReporters.spec.d.ts +0 -2
- package/cjs/writeToReporters.spec.d.ts.map +0 -1
- package/cjs/writeToReporters.spec.js +0 -59
- package/cjs/writeToReporters.spec.js.map +0 -1
- package/esm/LogEntry.d.ts +0 -7
- package/esm/LogEntry.d.ts.map +0 -1
- package/esm/LogEntry.js +0 -2
- package/esm/LogEntry.js.map +0 -1
- package/esm/captureLogs.d.ts +0 -4
- package/esm/captureLogs.d.ts.map +0 -1
- package/esm/captureLogs.js +0 -29
- package/esm/captureLogs.js.map +0 -1
- package/esm/captureLogs.spec.d.ts +0 -2
- package/esm/captureLogs.spec.d.ts.map +0 -1
- package/esm/captureLogs.spec.js +0 -45
- package/esm/captureLogs.spec.js.map +0 -1
- package/esm/config.d.ts +0 -12
- package/esm/config.d.ts.map +0 -1
- package/esm/config.js +0 -44
- package/esm/config.js.map +0 -1
- package/esm/config.spec.d.ts +0 -2
- package/esm/config.spec.d.ts.map +0 -1
- package/esm/config.spec.js +0 -67
- package/esm/config.spec.js.map +0 -1
- package/esm/configForTest.d.ts +0 -5
- package/esm/configForTest.d.ts.map +0 -1
- package/esm/configForTest.js +0 -14
- package/esm/configForTest.js.map +0 -1
- package/esm/configForTest.spec.d.ts +0 -2
- package/esm/configForTest.spec.d.ts.map +0 -1
- package/esm/configForTest.spec.js +0 -15
- package/esm/configForTest.spec.js.map +0 -1
- package/esm/console/createConsoleLogReporter.d.ts.map +0 -1
- package/esm/console/createConsoleLogReporter.js +0 -37
- package/esm/console/createConsoleLogReporter.js.map +0 -1
- package/esm/console/createConsoleLogReporter.spec.d.ts +0 -2
- package/esm/console/createConsoleLogReporter.spec.d.ts.map +0 -1
- package/esm/console/createConsoleLogReporter.spec.js.map +0 -1
- package/esm/console/index.d.ts +0 -4
- package/esm/console/index.d.ts.map +0 -1
- package/esm/console/index.js +0 -4
- package/esm/console/index.js.map +0 -1
- package/esm/console/isConsoleDebugAvailable.d.ts +0 -2
- package/esm/console/isConsoleDebugAvailable.d.ts.map +0 -1
- package/esm/console/isConsoleDebugAvailable.js +0 -13
- package/esm/console/isConsoleDebugAvailable.js.map +0 -1
- package/esm/console/polyfilledConsole.d.ts +0 -7
- package/esm/console/polyfilledConsole.d.ts.map +0 -1
- package/esm/console/polyfilledConsole.js +0 -32
- package/esm/console/polyfilledConsole.js.map +0 -1
- package/esm/console/semverGt.d.ts +0 -2
- package/esm/console/semverGt.d.ts.map +0 -1
- package/esm/console/semverGt.js +0 -9
- package/esm/console/semverGt.js.map +0 -1
- package/esm/console/semverGt.spec.d.ts +0 -2
- package/esm/console/semverGt.spec.d.ts.map +0 -1
- package/esm/console/semverGt.spec.js +0 -20
- package/esm/console/semverGt.spec.js.map +0 -1
- package/esm/console/toConsoleMethod.d.ts +0 -2
- package/esm/console/toConsoleMethod.d.ts.map +0 -1
- package/esm/console/toConsoleMethod.js +0 -18
- package/esm/console/toConsoleMethod.js.map +0 -1
- package/esm/console/types.d.ts +0 -3
- package/esm/console/types.d.ts.map +0 -1
- package/esm/console/types.js +0 -2
- package/esm/console/types.js.map +0 -1
- package/esm/customLogLevel.d.ts +0 -11
- package/esm/customLogLevel.d.ts.map +0 -1
- package/esm/customLogLevel.js +0 -30
- package/esm/customLogLevel.js.map +0 -1
- package/esm/customLogLevel.spec.d.ts +0 -2
- package/esm/customLogLevel.spec.d.ts.map +0 -1
- package/esm/customLogLevel.spec.js +0 -32
- package/esm/customLogLevel.spec.js.map +0 -1
- package/esm/formatter/createTimestampFormatter.d.ts +0 -3
- package/esm/formatter/createTimestampFormatter.d.ts.map +0 -1
- package/esm/formatter/createTimestampFormatter.js.map +0 -1
- package/esm/formatter/createTimestampFormatter.spec.d.ts +0 -2
- package/esm/formatter/createTimestampFormatter.spec.d.ts.map +0 -1
- package/esm/formatter/createTimestampFormatter.spec.js +0 -21
- package/esm/formatter/createTimestampFormatter.spec.js.map +0 -1
- package/esm/formatter/formatLogLevel.d.ts +0 -2
- package/esm/formatter/formatLogLevel.d.ts.map +0 -1
- package/esm/formatter/formatLogLevel.js +0 -6
- package/esm/formatter/formatLogLevel.js.map +0 -1
- package/esm/formatter/index.d.ts +0 -4
- package/esm/formatter/index.d.ts.map +0 -1
- package/esm/formatter/index.js +0 -4
- package/esm/formatter/index.js.map +0 -1
- package/esm/formatter/plainLogFormatter.d.ts +0 -3
- package/esm/formatter/plainLogFormatter.d.ts.map +0 -1
- package/esm/formatter/plainLogFormatter.js +0 -5
- package/esm/formatter/plainLogFormatter.js.map +0 -1
- package/esm/formatter/plainLogFormatter.spec.d.ts +0 -2
- package/esm/formatter/plainLogFormatter.spec.d.ts.map +0 -1
- package/esm/formatter/plainLogFormatter.spec.js +0 -7
- package/esm/formatter/plainLogFormatter.spec.js.map +0 -1
- package/esm/getDefaultReporter.browser.d.ts +0 -2
- package/esm/getDefaultReporter.browser.d.ts.map +0 -1
- package/esm/getDefaultReporter.browser.js +0 -11
- package/esm/getDefaultReporter.browser.js.map +0 -1
- package/esm/getDefaultReporter.d.ts +0 -2
- package/esm/getDefaultReporter.d.ts.map +0 -1
- package/esm/getDefaultReporter.js +0 -15
- package/esm/getDefaultReporter.js.map +0 -1
- package/esm/getLogModeFromEnvironment.browser.d.ts +0 -3
- package/esm/getLogModeFromEnvironment.browser.d.ts.map +0 -1
- package/esm/getLogModeFromEnvironment.browser.js +0 -5
- package/esm/getLogModeFromEnvironment.browser.js.map +0 -1
- package/esm/getLogModeFromEnvironment.d.ts +0 -3
- package/esm/getLogModeFromEnvironment.d.ts.map +0 -1
- package/esm/getLogModeFromEnvironment.js +0 -13
- package/esm/getLogModeFromEnvironment.js.map +0 -1
- package/esm/getLogModeFromEnvironment.spec.d.ts +0 -2
- package/esm/getLogModeFromEnvironment.spec.d.ts.map +0 -1
- package/esm/getLogModeFromEnvironment.spec.js +0 -20
- package/esm/getLogModeFromEnvironment.spec.js.map +0 -1
- package/esm/getLogger.d.ts +0 -9
- package/esm/getLogger.d.ts.map +0 -1
- package/esm/getLogger.js +0 -78
- package/esm/getLogger.js.map +0 -1
- package/esm/getLogger.spec.d.ts +0 -2
- package/esm/getLogger.spec.d.ts.map +0 -1
- package/esm/getLogger.spec.js +0 -385
- package/esm/getLogger.spec.js.map +0 -1
- package/esm/getLoggers.d.ts +0 -7
- package/esm/getLoggers.d.ts.map +0 -1
- package/esm/getLoggers.js +0 -11
- package/esm/getLoggers.js.map +0 -1
- package/esm/logLevel.d.ts +0 -106
- package/esm/logLevel.d.ts.map +0 -1
- package/esm/logLevel.js.map +0 -1
- package/esm/logLevel.spec.d.ts +0 -2
- package/esm/logLevel.spec.d.ts.map +0 -1
- package/esm/logLevel.spec.js +0 -148
- package/esm/logLevel.spec.js.map +0 -1
- package/esm/logLevelFn.d.ts +0 -20
- package/esm/logLevelFn.d.ts.map +0 -1
- package/esm/logLevelFn.js +0 -67
- package/esm/logLevelFn.js.map +0 -1
- package/esm/logReporter.d.ts +0 -7
- package/esm/logReporter.d.ts.map +0 -1
- package/esm/logReporter.js +0 -21
- package/esm/logReporter.js.map +0 -1
- package/esm/logReporter.spec.d.ts +0 -2
- package/esm/logReporter.spec.d.ts.map +0 -1
- package/esm/logReporter.spec.js +0 -93
- package/esm/logReporter.spec.js.map +0 -1
- package/esm/logReporterInternal.d.ts +0 -3
- package/esm/logReporterInternal.d.ts.map +0 -1
- package/esm/logReporterInternal.js +0 -19
- package/esm/logReporterInternal.js.map +0 -1
- package/esm/memory/MemoryLogReporter.d.ts.map +0 -1
- package/esm/memory/MemoryLogReporter.js +0 -51
- package/esm/memory/MemoryLogReporter.js.map +0 -1
- package/esm/memory/MemoryLogReporter.spec.d.ts +0 -2
- package/esm/memory/MemoryLogReporter.spec.d.ts.map +0 -1
- package/esm/memory/MemoryLogReporter.spec.js +0 -111
- package/esm/memory/MemoryLogReporter.spec.js.map +0 -1
- package/esm/memory/index.d.ts +0 -3
- package/esm/memory/index.d.ts.map +0 -1
- package/esm/memory/index.js +0 -3
- package/esm/memory/index.js.map +0 -1
- package/esm/memory/logEntriesToString.d.ts +0 -3
- package/esm/memory/logEntriesToString.d.ts.map +0 -1
- package/esm/memory/logEntriesToString.js +0 -6
- package/esm/memory/logEntriesToString.js.map +0 -1
- package/esm/memory/logEntriesToString.spec.d.ts +0 -2
- package/esm/memory/logEntriesToString.spec.d.ts.map +0 -1
- package/esm/memory/logEntriesToString.spec.js +0 -42
- package/esm/memory/logEntriesToString.spec.js.map +0 -1
- package/esm/memory/toInspectStringForObject.d.ts +0 -3
- package/esm/memory/toInspectStringForObject.d.ts.map +0 -1
- package/esm/memory/toInspectStringForObject.js +0 -11
- package/esm/memory/toInspectStringForObject.js.map +0 -1
- package/esm/shouldLog.d.ts +0 -8
- package/esm/shouldLog.d.ts.map +0 -1
- package/esm/shouldLog.js +0 -10
- package/esm/shouldLog.js.map +0 -1
- package/esm/store.d.ts +0 -3
- package/esm/store.d.ts.map +0 -1
- package/esm/store.js +0 -24
- package/esm/store.js.map +0 -1
- package/esm/suppressLogs.d.ts +0 -6
- package/esm/suppressLogs.d.ts.map +0 -1
- package/esm/suppressLogs.js +0 -9
- package/esm/suppressLogs.js.map +0 -1
- package/esm/suppressLogs.spec.d.ts +0 -2
- package/esm/suppressLogs.spec.d.ts.map +0 -1
- package/esm/suppressLogs.spec.js +0 -29
- package/esm/suppressLogs.spec.js.map +0 -1
- package/esm/typesInternal.d.ts +0 -20
- package/esm/typesInternal.d.ts.map +0 -1
- package/esm/typesInternal.js +0 -2
- package/esm/typesInternal.js.map +0 -1
- package/esm/utils.d.ts +0 -6
- package/esm/utils.d.ts.map +0 -1
- package/esm/utils.js +0 -11
- package/esm/utils.js.map +0 -1
- package/esm/writeToReporters.d.ts +0 -6
- package/esm/writeToReporters.d.ts.map +0 -1
- package/esm/writeToReporters.js +0 -18
- package/esm/writeToReporters.js.map +0 -1
- package/esm/writeToReporters.spec.d.ts +0 -2
- package/esm/writeToReporters.spec.d.ts.map +0 -1
- package/esm/writeToReporters.spec.js +0 -9
- package/esm/writeToReporters.spec.js.map +0 -1
- package/ts/LogEntry.ts +0 -7
- package/ts/captureLogs.ts +0 -35
- package/ts/config.ts +0 -57
- package/ts/configForTest.ts +0 -16
- package/ts/console/createConsoleLogReporter.ts +0 -48
- package/ts/console/index.ts +0 -3
- package/ts/console/isConsoleDebugAvailable.ts +0 -11
- package/ts/console/polyfilledConsole.ts +0 -34
- package/ts/console/semverGt.ts +0 -9
- package/ts/console/toConsoleMethod.ts +0 -18
- package/ts/console/types.ts +0 -3
- package/ts/customLogLevel.ts +0 -35
- package/ts/formatter/formatLogLevel.ts +0 -6
- package/ts/formatter/index.ts +0 -3
- package/ts/formatter/plainLogFormatter.ts +0 -6
- package/ts/getDefaultReporter.browser.ts +0 -13
- package/ts/getDefaultReporter.ts +0 -15
- package/ts/getLogModeFromEnvironment.browser.ts +0 -6
- package/ts/getLogModeFromEnvironment.ts +0 -16
- package/ts/getLogger.ts +0 -92
- package/ts/getLoggers.ts +0 -12
- package/ts/logLevelFn.ts +0 -72
- package/ts/logReporter.ts +0 -26
- package/ts/logReporterInternal.ts +0 -18
- package/ts/memory/MemoryLogReporter.ts +0 -72
- package/ts/memory/index.ts +0 -2
- package/ts/memory/logEntriesToString.ts +0 -7
- package/ts/memory/toInspectStringForObject.ts +0 -13
- package/ts/shouldLog.ts +0 -11
- package/ts/store.ts +0 -25
- package/ts/suppressLogs.ts +0 -14
- package/ts/typesInternal.ts +0 -21
- package/ts/utils.ts +0 -11
- package/ts/writeToReporters.ts +0 -20
package/cjs/logReporter.spec.js
DELETED
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var assertron_1 = __importDefault(require("assertron"));
|
|
7
|
-
var index_js_1 = require("./index.js");
|
|
8
|
-
var store_js_1 = require("./store.js");
|
|
9
|
-
var testUtil_js_1 = require("./testUtil.js");
|
|
10
|
-
describe('production checks', function () {
|
|
11
|
-
beforeEach(function () { return store_js_1.store.reset(); });
|
|
12
|
-
describe('addLogReporter()', function () {
|
|
13
|
-
test('throws in production mode', function () {
|
|
14
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
15
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
16
|
-
assertron_1.default.throws(function () { return (0, index_js_1.addLogReporter)(reporter); }, index_js_1.ProhibitedDuringProduction);
|
|
17
|
-
});
|
|
18
|
-
it('throw with ssf at call site', function () {
|
|
19
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
20
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
21
|
-
var err = assertron_1.default.throws(function () { return (0, index_js_1.addLogReporter)(reporter); }, index_js_1.ProhibitedDuringProduction);
|
|
22
|
-
(0, testUtil_js_1.assertSSF)(err, __filename);
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
describe('clearLogReporters()', function () {
|
|
26
|
-
test('throws in production mode', function () {
|
|
27
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
28
|
-
assertron_1.default.throws(function () { return (0, index_js_1.clearLogReporters)(); }, index_js_1.ProhibitedDuringProduction);
|
|
29
|
-
});
|
|
30
|
-
it('throw with ssf at call site', function () {
|
|
31
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
32
|
-
var err = assertron_1.default.throws(function () { return (0, index_js_1.clearLogReporters)(); }, index_js_1.ProhibitedDuringProduction);
|
|
33
|
-
(0, testUtil_js_1.assertSSF)(err, __filename);
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
describe('unit tests', function () {
|
|
38
|
-
beforeEach(function () {
|
|
39
|
-
store_js_1.store.reset();
|
|
40
|
-
(0, index_js_1.config)({ mode: 'test' });
|
|
41
|
-
});
|
|
42
|
-
describe('addLogReporter()', function () {
|
|
43
|
-
test('adds log reporter', function () {
|
|
44
|
-
var count = store_js_1.store.value.reporters.length;
|
|
45
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
46
|
-
(0, index_js_1.addLogReporter)(reporter);
|
|
47
|
-
expect(store_js_1.store.value.reporters.length).toBe(count + 1);
|
|
48
|
-
});
|
|
49
|
-
describe('add another console reporter', function () {
|
|
50
|
-
test('will not replace existing one', function () {
|
|
51
|
-
expect((0, index_js_1.getLogReporter)('console')).toBeDefined();
|
|
52
|
-
(0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c2' }));
|
|
53
|
-
expect((0, index_js_1.getLogReporter)('c2')).toBeUndefined();
|
|
54
|
-
expect((0, index_js_1.getLogReporter)('console')).toBeDefined();
|
|
55
|
-
});
|
|
56
|
-
test('will carry over existing filter', function () {
|
|
57
|
-
var filter = function (entry) { return entry.level < index_js_1.logLevels.alert; };
|
|
58
|
-
(0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c2', filter: filter }));
|
|
59
|
-
(0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c3' }));
|
|
60
|
-
var c3 = (0, index_js_1.getConsoleReporter)();
|
|
61
|
-
expect(c3.filter).toBe(filter);
|
|
62
|
-
});
|
|
63
|
-
test('will combine existing filter and new filter', function () {
|
|
64
|
-
(0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c2', filter: function (entry) { return entry.level > index_js_1.logLevels.critical; } }));
|
|
65
|
-
(0, index_js_1.addLogReporter)((0, index_js_1.createConsoleLogReporter)({ id: 'c3', filter: function (entry) { return entry.level < index_js_1.logLevels.error; } }));
|
|
66
|
-
var c2 = (0, index_js_1.getConsoleReporter)();
|
|
67
|
-
expect(c2.filter({ level: index_js_1.logLevels.info })).toBe(false);
|
|
68
|
-
expect(c2.filter({ level: index_js_1.logLevels.alert })).toBe(false);
|
|
69
|
-
});
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
describe('getLogReporter()', function () {
|
|
73
|
-
test('get log reporter by id', function () {
|
|
74
|
-
expect((0, index_js_1.getLogReporter)('console')).toBeDefined();
|
|
75
|
-
});
|
|
76
|
-
test('get log reporter with unknown id gets undefined', function () {
|
|
77
|
-
expect((0, index_js_1.getLogReporter)('blah')).toBeUndefined();
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
describe('clearLogReporters()', function () {
|
|
81
|
-
test('removes all reporters', function () {
|
|
82
|
-
(0, index_js_1.clearLogReporters)();
|
|
83
|
-
expect(store_js_1.store.value.reporters.length).toBe(0);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
describe('hasConsoleReporter()', function () {
|
|
87
|
-
test('returns true if there is a console reporter', function () {
|
|
88
|
-
expect((0, index_js_1.hasConsoleReporter)()).toBeTruthy();
|
|
89
|
-
});
|
|
90
|
-
test('returns false if there is no console reporter', function () {
|
|
91
|
-
(0, index_js_1.clearLogReporters)();
|
|
92
|
-
expect((0, index_js_1.hasConsoleReporter)()).toBeFalsy();
|
|
93
|
-
(0, index_js_1.addLogReporter)((0, index_js_1.createMemoryLogReporter)());
|
|
94
|
-
expect((0, index_js_1.hasConsoleReporter)()).toBeFalsy();
|
|
95
|
-
});
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
//# sourceMappingURL=logReporter.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logReporter.spec.js","sourceRoot":"","sources":["../ts/logReporter.spec.ts"],"names":[],"mappings":";;;;;AAAA,wDAAyB;AACzB,uCAKmB;AACnB,uCAAkC;AAClC,6CAAyC;AAEzC,QAAQ,CAAC,mBAAmB,EAAE;IAC5B,UAAU,CAAC,cAAM,OAAA,gBAAK,CAAC,KAAK,EAAE,EAAb,CAAa,CAAC,CAAA;IAE/B,QAAQ,CAAC,kBAAkB,EAAE;QAC3B,IAAI,CAAC,2BAA2B,EAAE;YAChC,IAAA,iBAAM,EAAC,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;YAC9B,IAAM,QAAQ,GAAG,IAAA,kCAAuB,GAAE,CAAA;YAC1C,mBAAC,CAAC,MAAM,CAAC,cAAM,OAAA,IAAA,yBAAc,EAAC,QAAQ,CAAC,EAAxB,CAAwB,EAAE,qC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A;IAEF,QAAQ,CAAC,qBAAqB,EAAE;QAC9B,IAAI,CAAC,uBAAuB,EAAE;YAC5B,IAAA,4BAAiB,GAAE,CAAA;YAEnB,MAAM,CAAC,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,sBAAsB,EAAE;QAC/B,IAAI,CAAC,6CAA6C,EAAE;YAClD,MAAM,CAAC,IAAA,6BAAkB,GAAE,CAAC,CAAC,UAAU,EAAE,CAAA;QAC3C,CAAC,CAAC,CAAA;QACF,IAAI,CAAC,+CAA+C,EAAE;YACpD,IAAA,4BAAiB,GAAE,CAAA;YACnB,MAAM,CAAC,IAAA,6BAAkB,GAAE,CAAC,CAAC,SAAS,EAAE,CAAA;YACxC,IAAA,yBAAc,EAAC,IAAA,kCAAuB,GAAE,CAAC,CAAA;YACzC,MAAM,CAAC,IAAA,6BAAkB,GAAE,CAAC,CAAC,SAAS,EAAE,CAAA;QAC1C,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import a from 'assertron'\nimport {\n addLogReporter, clearLogReporters, config,\n createConsoleLogReporter, createMemoryLogReporter,\n getConsoleReporter, getLogReporter, hasConsoleReporter,\n LogFilter, logLevels, ProhibitedDuringProduction\n} from './index.js'\nimport { store } from './store.js'\nimport { assertSSF } from './testUtil.js'\n\ndescribe('production checks', () => {\n beforeEach(() => store.reset())\n\n describe('addLogReporter()', () => {\n test('throws in production mode', () => {\n config({ mode: 'production' })\n const reporter = createMemoryLogReporter()\n a.throws(() => addLogReporter(reporter), ProhibitedDuringProduction)\n })\n\n it('throw with ssf at call site', () => {\n config({ mode: 'production' })\n const reporter = createMemoryLogReporter()\n const err = a.throws(() => addLogReporter(reporter), ProhibitedDuringProduction)\n\n assertSSF(err, __filename)\n })\n })\n\n describe('clearLogReporters()', () => {\n test('throws in production mode', () => {\n config({ mode: 'production' })\n a.throws(() => clearLogReporters(), ProhibitedDuringProduction)\n })\n it('throw with ssf at call site', () => {\n config({ mode: 'production' })\n const err = a.throws(() => clearLogReporters(), ProhibitedDuringProduction)\n\n assertSSF(err, __filename)\n })\n })\n})\n\ndescribe('unit tests', () => {\n beforeEach(() => {\n store.reset()\n config({ mode: 'test' })\n })\n\n describe('addLogReporter()', () => {\n test('adds log reporter', () => {\n const count = store.value.reporters.length\n const reporter = createMemoryLogReporter()\n addLogReporter(reporter)\n\n expect(store.value.reporters.length).toBe(count + 1)\n })\n\n describe('add another console reporter', () => {\n test('will not replace existing one', () => {\n expect(getLogReporter('console')).toBeDefined()\n addLogReporter(createConsoleLogReporter({ id: 'c2' }))\n expect(getLogReporter('c2')).toBeUndefined()\n expect(getLogReporter('console')).toBeDefined()\n })\n\n test('will carry over existing filter', () => {\n const filter: LogFilter = entry => entry.level < logLevels.alert\n addLogReporter(createConsoleLogReporter({ id: 'c2', filter }))\n addLogReporter(createConsoleLogReporter({ id: 'c3' }))\n const c3 = getConsoleReporter()!\n expect(c3.filter).toBe(filter)\n })\n\n test('will combine existing filter and new filter', () => {\n addLogReporter(createConsoleLogReporter({ id: 'c2', filter: entry => entry.level > logLevels.critical }))\n addLogReporter(createConsoleLogReporter({ id: 'c3', filter: entry => entry.level < logLevels.error }))\n const c2 = getConsoleReporter()!\n expect(c2.filter!({ level: logLevels.info } as any)).toBe(false)\n expect(c2.filter!({ level: logLevels.alert } as any)).toBe(false)\n })\n })\n })\n\n describe('getLogReporter()', () => {\n test('get log reporter by id', () => {\n expect(getLogReporter('console')).toBeDefined()\n })\n\n test('get log reporter with unknown id gets undefined', () => {\n expect(getLogReporter('blah')).toBeUndefined()\n })\n })\n\n describe('clearLogReporters()', () => {\n test('removes all reporters', () => {\n clearLogReporters()\n\n expect(store.value.reporters.length).toBe(0)\n })\n })\n\n describe('hasConsoleReporter()', () => {\n test('returns true if there is a console reporter', () => {\n expect(hasConsoleReporter()).toBeTruthy()\n })\n test('returns false if there is no console reporter', () => {\n clearLogReporters()\n expect(hasConsoleReporter()).toBeFalsy()\n addLogReporter(createMemoryLogReporter())\n expect(hasConsoleReporter()).toBeFalsy()\n })\n })\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logReporterInternal.d.ts","sourceRoot":"","sources":["../ts/logReporterInternal.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAExC,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,WAAW,QAa3D"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addLogReporterInternal = void 0;
|
|
4
|
-
var logReporter_js_1 = require("./logReporter.js");
|
|
5
|
-
var store_js_1 = require("./store.js");
|
|
6
|
-
function addLogReporterInternal(reporter) {
|
|
7
|
-
if (reporter.isConsoleReporter) {
|
|
8
|
-
var r = (0, logReporter_js_1.getConsoleReporter)();
|
|
9
|
-
if (r && reporter.filter) {
|
|
10
|
-
var f_1 = r.filter;
|
|
11
|
-
var f2_1 = reporter.filter;
|
|
12
|
-
if (f_1)
|
|
13
|
-
r.filter = function (entry) { return f_1(entry) && f2_1(entry); };
|
|
14
|
-
else
|
|
15
|
-
r.filter = f2_1;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
store_js_1.store.value.reporters.push(reporter);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.addLogReporterInternal = addLogReporterInternal;
|
|
23
|
-
//# sourceMappingURL=logReporterInternal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logReporterInternal.js","sourceRoot":"","sources":["../ts/logReporterInternal.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AACrD,uCAAkC;AAGlC,SAAgB,sBAAsB,CAAC,QAAqB;IAC1D,IAAI,QAAQ,CAAC,iBAAiB,EAAE;QAC9B,IAAM,CAAC,GAAG,IAAA,mCAAkB,GAAE,CAAA;QAC9B,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE;YACxB,IAAM,GAAC,GAAG,CAAC,CAAC,MAAM,CAAA;YAClB,IAAM,IAAE,GAAG,QAAQ,CAAC,MAAM,CAAA;YAC1B,IAAI,GAAC;gBAAE,CAAC,CAAC,MAAM,GAAG,UAAA,KAAK,IAAI,OAAA,GAAC,CAAC,KAAK,CAAC,IAAI,IAAE,CAAC,KAAK,CAAC,EAArB,CAAqB,CAAA;;gBAC3C,CAAC,CAAC,MAAM,GAAG,IAAE,CAAA;SACnB;KACF;SACI;QACH,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;KACrC;AACH,CAAC;AAbD,wDAaC","sourcesContent":["import { getConsoleReporter } from './logReporter.js'\nimport { store } from './store.js'\nimport { LogReporter } from './types.js'\n\nexport function addLogReporterInternal(reporter: LogReporter) {\n if (reporter.isConsoleReporter) {\n const r = getConsoleReporter()\n if (r && reporter.filter) {\n const f = r.filter\n const f2 = reporter.filter\n if (f) r.filter = entry => f(entry) && f2(entry)\n else r.filter = f2\n }\n }\n else {\n store.value.reporters.push(reporter)\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryLogReporter.d.ts","sourceRoot":"","sources":["../../ts/memory/MemoryLogReporter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAa,YAAY,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAIhG,oBAAY,iBAAiB,GAAG,WAAW,CAAC,QAAQ,CAAC,GAAG;IACtD,IAAI,EAAE,QAAQ,EAAE,CAAC;IACjB;;;OAGG;IACH,aAAa,IAAI,MAAM,CAAC;IACxB,sBAAsB,IAAI,MAAM,CAAA;CACjC,CAAA;AAED,oBAAY,kBAAkB,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAA;AAUvD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAQlD;AAGD,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE,kBAAkB,CAAC,QAAQ,CAAC,GAAG,iBAAiB,CAkCjG"}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createMemoryLogReporter = exports.toMessageWithLevel = void 0;
|
|
4
|
-
var type_plus_1 = require("type-plus");
|
|
5
|
-
var index_js_1 = require("../formatter/index.js");
|
|
6
|
-
var utils_js_1 = require("../utils.js");
|
|
7
|
-
var toInspectStringForObject_js_1 = require("./toInspectStringForObject.js");
|
|
8
|
-
function createGetLogMessage() {
|
|
9
|
-
return function getLogMessage() {
|
|
10
|
-
return this.logs.map(toInspectStringForObject_js_1.toInspectLogEntry)
|
|
11
|
-
.map(function (log) { return log.args.join(' '); })
|
|
12
|
-
.join('\n');
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
function toMessageWithLevel(logs) {
|
|
16
|
-
return logs.map(toInspectStringForObject_js_1.toInspectLogEntry)
|
|
17
|
-
.map(function (log) { return "".concat((0, index_js_1.formatLogLevel)(log.level), " ").concat(log.args.join(' ')); })
|
|
18
|
-
.join('\n')
|
|
19
|
-
// if it has more than this log,
|
|
20
|
-
// we assume it is running under tests,
|
|
21
|
-
// and remove this log to simplify testing.
|
|
22
|
-
.replace(/^\(WARN\) already configured for test, ignoring config\(\) call\n/, '');
|
|
23
|
-
}
|
|
24
|
-
exports.toMessageWithLevel = toMessageWithLevel;
|
|
25
|
-
function createMemoryLogReporter(options) {
|
|
26
|
-
var opt = (0, type_plus_1.required)({ id: 'memory', formatter: function (e) { return e; } }, options);
|
|
27
|
-
var id = opt.id;
|
|
28
|
-
var formatter = opt.formatter, filter = opt.filter;
|
|
29
|
-
return {
|
|
30
|
-
id: id,
|
|
31
|
-
get formatter() {
|
|
32
|
-
return formatter;
|
|
33
|
-
},
|
|
34
|
-
set formatter(value) {
|
|
35
|
-
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.formatter', Object.getOwnPropertyDescriptor(this, 'formatter').set);
|
|
36
|
-
formatter = value;
|
|
37
|
-
},
|
|
38
|
-
get filter() {
|
|
39
|
-
return filter;
|
|
40
|
-
},
|
|
41
|
-
set filter(value) {
|
|
42
|
-
(0, utils_js_1.assertLogModeIsNotProduction)('set Reporter.filter', Object.getOwnPropertyDescriptor(this, 'filter').set);
|
|
43
|
-
filter = value;
|
|
44
|
-
},
|
|
45
|
-
logs: [],
|
|
46
|
-
write: function (entry) {
|
|
47
|
-
if (filter && !filter(entry))
|
|
48
|
-
return;
|
|
49
|
-
this.logs.push(formatter(entry));
|
|
50
|
-
},
|
|
51
|
-
getLogMessage: createGetLogMessage(),
|
|
52
|
-
getLogMessageWithLevel: function () { return toMessageWithLevel(this.logs); }
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
exports.createMemoryLogReporter = createMemoryLogReporter;
|
|
56
|
-
//# sourceMappingURL=MemoryLogReporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryLogReporter.js","sourceRoot":"","sources":["../../ts/memory/MemoryLogReporter.ts"],"names":[],"mappings":";;;AAAA,uCAAoC;AACpC,kDAAsD;AAEtD,wCAA0D;AAC1D,6EAAiE;AAcjE,SAAS,mBAAmB;IAC1B,OAAO,SAAS,aAAa;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,+CAAiB,CAAC;aACpC,GAAG,CAAC,UAAA,GAAG,IAAI,OAAA,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAlB,CAAkB,CAAC;aAC9B,IAAI,CAAC,IAAI,CAAC,CAAA;IACf,CAAC,CAAA;AACH,CAAC;AAED,S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EAAE,EAAE;QACR,KAAK,YAAC,KAAK;YACT,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,OAAM;YACpC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAA;QAClC,CAAC;QACD,aAAa,EAAE,mBAAmB,EAAE;QACpC,sBAAsB,gBAAK,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC;KAClE,CAAA;AACH,CAAC;AAlCD,0DAkCC","sourcesContent":["import { required } from 'type-plus'\nimport { formatLogLevel } from '../formatter/index.js'\nimport { LogEntry, LogFilter, LogFormatter, LogReporter, LogReporterOptions } from '../types.js'\nimport { assertLogModeIsNotProduction } from '../utils.js'\nimport { toInspectLogEntry } from './toInspectStringForObject.js'\n\nexport type MemoryLogReporter = LogReporter<LogEntry> & {\n logs: LogEntry[],\n /**\n * Gets a simple log message for testing.\n * The message only contains arguments for each log entry.\n */\n getLogMessage(): string,\n getLogMessageWithLevel(): string\n}\n\nexport type MemoryLogFormatter = LogFormatter<LogEntry>\n\nfunction createGetLogMessage() {\n return function getLogMessage(this: { logs: LogEntry[] }) {\n return this.logs.map(toInspectLogEntry)\n .map(log => log.args.join(' '))\n .join('\\n')\n }\n}\n\nexport function toMessageWithLevel(logs: LogEntry[]) {\n return logs.map(toInspectLogEntry)\n .map(log => `${formatLogLevel(log.level)} ${log.args.join(' ')}`)\n .join('\\n')\n // if it has more than this log,\n // we assume it is running under tests,\n // and remove this log to simplify testing.\n .replace(/^\\(WARN\\) already configured for test, ignoring config\\(\\) call\\n/, '')\n}\n\n\nexport function createMemoryLogReporter(options?: LogReporterOptions<LogEntry>): MemoryLogReporter {\n const opt = required({ id: 'memory', formatter: (e: LogEntry) => e }, options)\n const { id } = opt\n let { formatter, filter } = opt\n return {\n id,\n get formatter() {\n return formatter\n },\n set formatter(value: MemoryLogFormatter) {\n assertLogModeIsNotProduction(\n 'set Reporter.formatter',\n Object.getOwnPropertyDescriptor(this, 'formatter')!.set!\n )\n formatter = value\n },\n get filter() {\n return filter\n },\n set filter(value: LogFilter) {\n assertLogModeIsNotProduction(\n 'set Reporter.filter',\n Object.getOwnPropertyDescriptor(this, 'filter')!.set!\n )\n filter = value\n },\n logs: [],\n write(entry) {\n if (filter && !filter(entry)) return\n this.logs.push(formatter(entry))\n },\n getLogMessage: createGetLogMessage(),\n getLogMessageWithLevel() { return toMessageWithLevel(this.logs) }\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryLogReporter.spec.d.ts","sourceRoot":"","sources":["../../ts/memory/MemoryLogReporter.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
var assertron_1 = __importDefault(require("assertron"));
|
|
18
|
-
var index_js_1 = require("../index.js");
|
|
19
|
-
var configForTest_js_1 = require("../configForTest.js");
|
|
20
|
-
var getLogger_js_1 = require("../getLogger.js");
|
|
21
|
-
var store_js_1 = require("../store.js");
|
|
22
|
-
var testUtil_js_1 = require("../testUtil.js");
|
|
23
|
-
describe('production checks', function () {
|
|
24
|
-
beforeEach(function () { return store_js_1.store.reset(); });
|
|
25
|
-
test('set formatter in production mode throws', function () {
|
|
26
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
27
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
28
|
-
assertron_1.default.throws(function () { reporter.formatter = function (e) { return e; }; }, index_js_1.ProhibitedDuringProduction);
|
|
29
|
-
});
|
|
30
|
-
it('set formatter throws with ssf at call site', function () {
|
|
31
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
32
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
33
|
-
var err = assertron_1.default.throws(function () { reporter.formatter = function (e) { return e; }; }, index_js_1.ProhibitedDuringProduction);
|
|
34
|
-
(0, testUtil_js_1.assertSSF)(err, __filename);
|
|
35
|
-
});
|
|
36
|
-
test('set filter in production mode throws', function () {
|
|
37
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
38
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
39
|
-
assertron_1.default.throws(function () { reporter.filter = function () { return true; }; }, index_js_1.ProhibitedDuringProduction);
|
|
40
|
-
});
|
|
41
|
-
it('set filter throws with ssf at call site', function () {
|
|
42
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
43
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
44
|
-
var err = assertron_1.default.throws(function () { reporter.filter = function () { return true; }; }, index_js_1.ProhibitedDuringProduction);
|
|
45
|
-
(0, testUtil_js_1.assertSSF)(err, __filename);
|
|
46
|
-
});
|
|
47
|
-
describe('getLogMessageWithLevel()', function () {
|
|
48
|
-
test('the production log is omitted', function () {
|
|
49
|
-
var reporter = (0, configForTest_js_1.configForTest)().reporter;
|
|
50
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
51
|
-
(0, getLogger_js_1.getLogger)('test').warn('some test warnings');
|
|
52
|
-
expect(reporter.getLogMessageWithLevel()).toEqual("(WARN) some test warnings");
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
});
|
|
56
|
-
describe('unit tests', function () {
|
|
57
|
-
beforeEach(function () {
|
|
58
|
-
store_js_1.store.reset();
|
|
59
|
-
(0, index_js_1.config)({ mode: 'test' });
|
|
60
|
-
});
|
|
61
|
-
test('log entries are saved in the `logs` property', function () {
|
|
62
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
63
|
-
var entry = { id: 'log', level: 1, args: ['some messages'], timestamp: new Date() };
|
|
64
|
-
reporter.write(entry);
|
|
65
|
-
expect(reporter.logs).toEqual([entry]);
|
|
66
|
-
});
|
|
67
|
-
test('can override id', function () {
|
|
68
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)({ id: 'custom-id-mem' });
|
|
69
|
-
expect(reporter.id).toBe('custom-id-mem');
|
|
70
|
-
});
|
|
71
|
-
test('can filter', function () {
|
|
72
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)({ filter: function (entry) { return entry.id !== 'secret'; } });
|
|
73
|
-
reporter.write({ id: 'ok', level: 1, args: ['some messages'], timestamp: new Date() });
|
|
74
|
-
reporter.write({ id: 'secret', level: 1, args: ['some messages'], timestamp: new Date() });
|
|
75
|
-
expect(reporter.logs.length).toBe(1);
|
|
76
|
-
});
|
|
77
|
-
test('can change filter', function () {
|
|
78
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
79
|
-
var filter = reporter.filter;
|
|
80
|
-
reporter.filter = function (entry) { return entry.id !== 'secret'; };
|
|
81
|
-
expect(reporter.filter).not.toEqual(filter);
|
|
82
|
-
});
|
|
83
|
-
test('formatter can be used to pre-process the log', function () {
|
|
84
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)({
|
|
85
|
-
formatter: function (entry) { return (__assign(__assign({}, entry), { args: entry.args.map(function (arg) { return arg === 'secret' ? '<censored>' : arg; }) })); }
|
|
86
|
-
});
|
|
87
|
-
var entry = { id: 'log', level: 1, args: ['a', 'secret', 'b'], timestamp: new Date() };
|
|
88
|
-
reporter.write(entry);
|
|
89
|
-
expect(reporter.logs[0].args[1]).toBe('<censored>');
|
|
90
|
-
});
|
|
91
|
-
test('can change formatter', function () {
|
|
92
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
93
|
-
var formatter = reporter.formatter;
|
|
94
|
-
reporter.formatter = function (e) { return (__assign(__assign({}, e), { args: e.args.reverse() })); };
|
|
95
|
-
expect(reporter.formatter).not.toEqual(formatter);
|
|
96
|
-
});
|
|
97
|
-
describe('getLogMessages()', function () {
|
|
98
|
-
test('empty logs returns empty string', function () {
|
|
99
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
100
|
-
expect(reporter.getLogMessage()).toEqual('');
|
|
101
|
-
});
|
|
102
|
-
test('print args', function () {
|
|
103
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
104
|
-
var entry = { id: 'log', level: 1, args: ['miku', 'is', 'singing'], timestamp: new Date() };
|
|
105
|
-
reporter.write(entry);
|
|
106
|
-
expect(reporter.getLogMessage()).toEqual('miku is singing');
|
|
107
|
-
});
|
|
108
|
-
test('print object arg', function () {
|
|
109
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
110
|
-
var entry = { id: 'log', level: 1, args: [{ 'miku': 'sing' }], timestamp: new Date() };
|
|
111
|
-
reporter.write(entry);
|
|
112
|
-
expect(reporter.getLogMessage()).toEqual("{ miku: 'sing' }");
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
describe('getLogMessageWithLevel', function () {
|
|
116
|
-
test('print with level', function () {
|
|
117
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
118
|
-
reporter.write({ id: 'log', level: index_js_1.logLevels.info, args: ['msg 1'], timestamp: new Date() });
|
|
119
|
-
reporter.write({ id: 'log', level: index_js_1.logLevels.warn, args: ['msg 2'], timestamp: new Date() });
|
|
120
|
-
expect(reporter.getLogMessageWithLevel()).toEqual("(INFO) msg 1\n(WARN) msg 2");
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
//# sourceMappingURL=Memory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AAQ,CAAC,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAA;QAC9D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,QAAQ,CAAC,wBAAwB,EAAE;QACjC,IAAI,CAAC,kBAAkB,EAAE;YACvB,IAAM,QAAQ,GAAG,IAAA,kCAAuB,GAAE,CAAA;YAC1C,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAA;YAC5F,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,oBAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAA;YAC5F,MAAM,CAAC,QAAQ,CAAC,sBAAsB,EAAE,CAAC,CAAC,OAAO,CAAC,4BAA4B,CAAC,CAAA;QACjF,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA","sourcesContent":["import a from 'assertron'\nimport { config, createMemoryLogReporter, logLevels, ProhibitedDuringProduction } from '../index.js'\nimport { configForTest } from '../configForTest.js'\nimport { getLogger } from '../getLogger.js'\nimport { store } from '../store.js'\nimport { assertSSF } from '../testUtil.js'\n\ndescribe('production checks', () => {\n beforeEach(() => store.reset())\n test('set formatter in production mode throws', () => {\n config({ mode: 'production' })\n const reporter = createMemoryLogReporter()\n\n a.throws(() => { reporter.formatter = e => e }, ProhibitedDuringProduction)\n })\n it('set formatter throws with ssf at call site', () => {\n config({ mode: 'production' })\n const reporter = createMemoryLogReporter()\n\n const err = a.throws(() => { reporter.formatter = e => e }, ProhibitedDuringProduction)\n\n assertSSF(err, __filename)\n })\n\n test('set filter in production mode throws', () => {\n config({ mode: 'production' })\n const reporter = createMemoryLogReporter()\n a.throws(() => { reporter.filter = () => true }, ProhibitedDuringProduction)\n })\n\n it('set filter throws with ssf at call site', () => {\n config({ mode: 'production' })\n const reporter = createMemoryLogReporter()\n const err = a.throws(() => { reporter.filter = () => true }, ProhibitedDuringProduction)\n\n assertSSF(err, __filename)\n })\n\n describe('getLogMessageWithLevel()', () => {\n test('the production log is omitted', () => {\n const { reporter } = configForTest()\n config({ mode: 'production' })\n getLogger('test').warn('some test warnings')\n expect(reporter.getLogMessageWithLevel()).toEqual(`(WARN) some test warnings`)\n })\n })\n})\n\ndescribe('unit tests', () => {\n beforeEach(() => {\n store.reset()\n config({ mode: 'test' })\n })\n test('log entries are saved in the `logs` property', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: ['some messages'], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.logs).toEqual([entry])\n })\n\n test('can override id', () => {\n const reporter = createMemoryLogReporter({ id: 'custom-id-mem' })\n expect(reporter.id).toBe('custom-id-mem')\n })\n\n test('can filter', () => {\n const reporter = createMemoryLogReporter({ filter(entry) { return entry.id !== 'secret' } })\n reporter.write({ id: 'ok', level: 1, args: ['some messages'], timestamp: new Date() })\n reporter.write({ id: 'secret', level: 1, args: ['some messages'], timestamp: new Date() })\n expect(reporter.logs.length).toBe(1)\n })\n\n test('can change filter', () => {\n const reporter = createMemoryLogReporter()\n const filter = reporter.filter\n reporter.filter = entry => entry.id !== 'secret'\n expect(reporter.filter).not.toEqual(filter)\n })\n\n test('formatter can be used to pre-process the log', () => {\n const reporter = createMemoryLogReporter({\n formatter: (entry) => ({\n ...entry,\n args: entry.args.map(arg => arg === 'secret' ? '<censored>' : arg)\n })\n })\n\n const entry = { id: 'log', level: 1, args: ['a', 'secret', 'b'], timestamp: new Date() }\n reporter.write(entry)\n\n expect(reporter.logs[0].args[1]).toBe('<censored>')\n })\n\n test('can change formatter', () => {\n const reporter = createMemoryLogReporter()\n const formatter = reporter.formatter\n reporter.formatter = e => ({ ...e, args: e.args.reverse() })\n expect(reporter.formatter).not.toEqual(formatter)\n })\n\n describe('getLogMessages()', () => {\n test('empty logs returns empty string', () => {\n const reporter = createMemoryLogReporter()\n\n expect(reporter.getLogMessage()).toEqual('')\n })\n\n test('print args', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: ['miku', 'is', 'singing'], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.getLogMessage()).toEqual('miku is singing')\n })\n\n test('print object arg', () => {\n const reporter = createMemoryLogReporter()\n const entry = { id: 'log', level: 1, args: [{ 'miku': 'sing' }], timestamp: new Date() }\n reporter.write(entry)\n expect(reporter.getLogMessage()).toEqual(\"{ miku: 'sing' }\")\n })\n })\n\n describe('getLogMessageWithLevel', () => {\n test('print with level', () => {\n const reporter = createMemoryLogReporter()\n reporter.write({ id: 'log', level: logLevels.info, args: ['msg 1'], timestamp: new Date() })\n reporter.write({ id: 'log', level: logLevels.warn, args: ['msg 2'], timestamp: new Date() })\n expect(reporter.getLogMessageWithLevel()).toEqual(`(INFO) msg 1\\n(WARN) msg 2`)\n })\n })\n})\n"]}
|
package/cjs/memory/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/memory/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA"}
|
package/cjs/memory/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./logEntriesToString.js"), exports);
|
|
18
|
-
__exportStar(require("./MemoryLogReporter.js"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
package/cjs/memory/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/memory/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAuC;AACvC,yDAAsC","sourcesContent":["export * from './logEntriesToString.js'\nexport * from './MemoryLogReporter.js'\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logEntriesToString.d.ts","sourceRoot":"","sources":["../../ts/memory/logEntriesToString.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAGtC,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,EAAE,UAElD"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.logEntriesToString = void 0;
|
|
4
|
-
var index_js_1 = require("../formatter/index.js");
|
|
5
|
-
var toInspectStringForObject_js_1 = require("./toInspectStringForObject.js");
|
|
6
|
-
function logEntriesToString(logs) {
|
|
7
|
-
return logs.map(toInspectStringForObject_js_1.toInspectLogEntry).map(index_js_1.plainLogFormatter).join('\n');
|
|
8
|
-
}
|
|
9
|
-
exports.logEntriesToString = logEntriesToString;
|
|
10
|
-
//# sourceMappingURL=logEntriesToString.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logEntriesToString.js","sourceRoot":"","sources":["../../ts/memory/logEntriesToString.ts"],"names":[],"mappings":";;;AAAA,kDAAyD;AAEzD,6EAAiE;AAEjE,SAAgB,kBAAkB,CAAC,IAAgB;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC,+CAAiB,CAAC,CAAC,GAAG,CAAC,4BAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACtE,CAAC;AAFD,gDAEC","sourcesContent":["import { plainLogFormatter } from '../formatter/index.js'\nimport { LogEntry } from '../types.js'\nimport { toInspectLogEntry } from './toInspectStringForObject.js'\n\nexport function logEntriesToString(logs: LogEntry[]) {\n return logs.map(toInspectLogEntry).map(plainLogFormatter).join('\\n')\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logEntriesToString.spec.d.ts","sourceRoot":"","sources":["../../ts/memory/logEntriesToString.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var index_js_1 = require("../index.js");
|
|
4
|
-
test('convert log entries to string', function () {
|
|
5
|
-
var timestamp = new Date(2019, 6);
|
|
6
|
-
var actual = (0, index_js_1.logEntriesToString)([
|
|
7
|
-
{ id: 'log', level: index_js_1.logLevels.emergency, args: ['emergency'], timestamp: timestamp },
|
|
8
|
-
{ id: 'log', level: index_js_1.logLevels.critical, args: ['critical'], timestamp: timestamp },
|
|
9
|
-
{ id: 'log', level: index_js_1.logLevels.alert, args: ['alert'], timestamp: timestamp },
|
|
10
|
-
{ id: 'log', level: index_js_1.logLevels.error, args: ['error'], timestamp: timestamp },
|
|
11
|
-
{ id: 'log', level: index_js_1.logLevels.warn, args: ['warn'], timestamp: timestamp },
|
|
12
|
-
{ id: 'log', level: index_js_1.logLevels.notice, args: ['notice'], timestamp: timestamp },
|
|
13
|
-
{ id: 'log', level: index_js_1.logLevels.info, args: ['info'], timestamp: timestamp },
|
|
14
|
-
{ id: 'log', level: index_js_1.logLevels.debug, args: ['debug'], timestamp: timestamp },
|
|
15
|
-
{ id: 'log', level: index_js_1.logLevels.trace, args: ['trace'], timestamp: timestamp }
|
|
16
|
-
]);
|
|
17
|
-
var iso = timestamp.toISOString();
|
|
18
|
-
expect(actual).toEqual("".concat(iso, ",log,(EMERGENCY),emergency\n").concat(iso, ",log,(CRITICAL),critical\n").concat(iso, ",log,(ALERT),alert\n").concat(iso, ",log,(ERROR),error\n").concat(iso, ",log,(WARN),warn\n").concat(iso, ",log,(NOTICE),notice\n").concat(iso, ",log,(INFO),info\n").concat(iso, ",log,(DEBUG),debug\n").concat(iso, ",log,(TRACE),trace"));
|
|
19
|
-
});
|
|
20
|
-
test('print out object', function () {
|
|
21
|
-
var timestamp = new Date(2021, 4);
|
|
22
|
-
var actual = (0, index_js_1.logEntriesToString)([
|
|
23
|
-
{ id: 'log', level: index_js_1.logLevels.info, args: ['a', { a: 1 }], timestamp: timestamp }
|
|
24
|
-
]);
|
|
25
|
-
var iso = timestamp.toISOString();
|
|
26
|
-
expect(actual).toEqual("".concat(iso, ",log,(INFO),a,{ a: 1 }"));
|
|
27
|
-
});
|
|
28
|
-
test('print out array', function () {
|
|
29
|
-
var timestamp = new Date(2021, 4);
|
|
30
|
-
var actual = (0, index_js_1.logEntriesToString)([
|
|
31
|
-
{ id: 'log', level: index_js_1.logLevels.info, args: ['a', [1, 2, 3]], timestamp: timestamp }
|
|
32
|
-
]);
|
|
33
|
-
var iso = timestamp.toISOString();
|
|
34
|
-
expect(actual).toEqual("".concat(iso, ",log,(INFO),a,[ 1, 2, 3 ]"));
|
|
35
|
-
});
|
|
36
|
-
//# sourceMappingURL=logEntriesToString.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logEntri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,WAAA,EAAE;KACxE,CAAC,CAAA;IAEF,IAAM,GAAG,GAAG,SAAS,CAAC,WAAW,EAAE,CAAA;IACnC,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,UAAG,GAAG,8BAA2B,CAAC,CAAA;AAC3D,CAAC,CAAC,CAAA","sourcesContent":["import { logLevels, logEntriesToString } from '../index.js'\n\ntest('convert log entries to string', () => {\n const timestamp = new Date(2019, 6)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.emergency, args: ['emergency'], timestamp },\n { id: 'log', level: logLevels.critical, args: ['critical'], timestamp },\n { id: 'log', level: logLevels.alert, args: ['alert'], timestamp },\n { id: 'log', level: logLevels.error, args: ['error'], timestamp },\n { id: 'log', level: logLevels.warn, args: ['warn'], timestamp },\n { id: 'log', level: logLevels.notice, args: ['notice'], timestamp },\n { id: 'log', level: logLevels.info, args: ['info'], timestamp },\n { id: 'log', level: logLevels.debug, args: ['debug'], timestamp },\n { id: 'log', level: logLevels.trace, args: ['trace'], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(EMERGENCY),emergency\n${iso},log,(CRITICAL),critical\n${iso},log,(ALERT),alert\n${iso},log,(ERROR),error\n${iso},log,(WARN),warn\n${iso},log,(NOTICE),notice\n${iso},log,(INFO),info\n${iso},log,(DEBUG),debug\n${iso},log,(TRACE),trace`)\n})\n\ntest('print out object', () => {\n const timestamp = new Date(2021, 4)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.info, args: ['a', { a: 1 }], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(INFO),a,{ a: 1 }`)\n})\n\ntest('print out array', () => {\n const timestamp = new Date(2021, 4)\n const actual = logEntriesToString([\n { id: 'log', level: logLevels.info, args: ['a', [1, 2, 3]], timestamp }\n ])\n\n const iso = timestamp.toISOString()\n expect(actual).toEqual(`${iso},log,(INFO),a,[ 1, 2, 3 ]`)\n})\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toInspectStringForObject.d.ts","sourceRoot":"","sources":["../../ts/memory/toInspectStringForObject.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAEzC,eAAO,MAAM,iBAAiB,MAIf,QAAQ,aAKD,CAAA"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.toInspectLogEntry = void 0;
|
|
7
|
-
var is_node_1 = __importDefault(require("is-node"));
|
|
8
|
-
exports.toInspectLogEntry = is_node_1.default
|
|
9
|
-
? (function () {
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
11
|
-
var inspect = require('util').inspect;
|
|
12
|
-
return function (e) { return (e.args = e.args.map(function (value) { return typeof value === 'object' && value !== null ? inspect(value) : value; }),
|
|
13
|
-
e); };
|
|
14
|
-
})()
|
|
15
|
-
// istanbul ignore next
|
|
16
|
-
: function (e) { return e; };
|
|
17
|
-
//# sourceMappingURL=toInspectStringForObject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toInspectStringForObject.js","sourceRoot":"","sources":["../../ts/memory/toInspectStringForObject.ts"],"names":[],"mappings":";;;;;;AAAA,oDAA4B;AAGf,QAAA,iBAAiB,GAAG,iBAAM;IACrC,CAAC,CAAC,CAAC;QACD,8DAA8D;QAC9D,IAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAA;QACvC,OAAO,UAAC,CAAW,IAAK,OAAA,CACtB,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAA,KAAK,IAAI,OAAA,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,EAApE,CAAoE,CAAC;YAClG,CAAC,CAAC,EAFoB,CAEpB,CAAA;IACN,CAAC,CAAC,EAAE;IACJ,uBAAuB;IACvB,CAAC,CAAC,UAAC,CAAW,IAAK,OAAA,CAAC,EAAD,CAAC,CAAA","sourcesContent":["import isNode from 'is-node'\nimport { LogEntry } from '../LogEntry.js'\n\nexport const toInspectLogEntry = isNode\n ? (() => {\n // eslint-disable-next-line @typescript-eslint/no-var-requires\n const inspect = require('util').inspect\n return (e: LogEntry) => (\n e.args = e.args.map(value => typeof value === 'object' && value !== null ? inspect(value) : value),\n e)\n })()\n // istanbul ignore next\n : (e: LogEntry) => e\n"]}
|
package/cjs/shouldLog.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { LogLevel } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Determines should you log.
|
|
4
|
-
* @param loggerLevel Log level of the logger.
|
|
5
|
-
* It can be undefined which the global log level will be used.
|
|
6
|
-
*/
|
|
7
|
-
export declare function shouldLog(targetLevel: LogLevel, loggerLevel: LogLevel | undefined): boolean;
|
|
8
|
-
//# sourceMappingURL=shouldLog.d.ts.map
|
package/cjs/shouldLog.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shouldLog.d.ts","sourceRoot":"","sources":["../ts/shouldLog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAErC;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,QAAQ,GAAG,SAAS,WAEjF"}
|
package/cjs/shouldLog.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.shouldLog = void 0;
|
|
4
|
-
var store_js_1 = require("./store.js");
|
|
5
|
-
/**
|
|
6
|
-
* Determines should you log.
|
|
7
|
-
* @param loggerLevel Log level of the logger.
|
|
8
|
-
* It can be undefined which the global log level will be used.
|
|
9
|
-
*/
|
|
10
|
-
function shouldLog(targetLevel, loggerLevel) {
|
|
11
|
-
return targetLevel <= (loggerLevel !== undefined ? loggerLevel : store_js_1.store.value.logLevel);
|
|
12
|
-
}
|
|
13
|
-
exports.shouldLog = shouldLog;
|
|
14
|
-
//# sourceMappingURL=shouldLog.js.map
|
package/cjs/shouldLog.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shouldLog.js","sourceRoot":"","sources":["../ts/shouldLog.ts"],"names":[],"mappings":";;;AAAA,uCAAkC;AAGlC;;;;GAIG;AACH,SAAgB,SAAS,CAAC,WAAqB,EAAE,WAAiC;IAChF,OAAO,WAAW,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AACxF,CAAC;AAFD,8BAEC","sourcesContent":["import { store } from './store.js'\nimport { LogLevel } from './types.js'\n\n/**\n * Determines should you log.\n * @param loggerLevel Log level of the logger.\n * It can be undefined which the global log level will be used.\n */\nexport function shouldLog(targetLevel: LogLevel, loggerLevel: LogLevel | undefined) {\n return targetLevel <= (loggerLevel !== undefined ? loggerLevel : store.value.logLevel)\n}\n"]}
|
package/cjs/store.d.ts
DELETED
package/cjs/store.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../ts/store.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAE7C,eAAO,MAAM,KAAK,wCAmBhB,CAAA"}
|
package/cjs/store.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.store = void 0;
|
|
15
|
-
var global_store_1 = require("global-store");
|
|
16
|
-
var getLogModeFromEnvironment_js_1 = require("./getLogModeFromEnvironment.js");
|
|
17
|
-
var logLevel_js_1 = require("./logLevel.js");
|
|
18
|
-
exports.store = (0, global_store_1.createStore)({
|
|
19
|
-
moduleName: 'standard-log',
|
|
20
|
-
key: 'e53d0937-f420-40a0-9901-099725fa4a53',
|
|
21
|
-
version: '2.0.0',
|
|
22
|
-
initializer: function (current) {
|
|
23
|
-
var mode = (0, getLogModeFromEnvironment_js_1.getLogModeFromEnvironment)() || 'production';
|
|
24
|
-
return __assign({ addCustomLogLevelListeners: [], configured: false, loggerClosures: {}, redirects: {}, reporters: [], customLevels: {}, customLevelsReverse: [], mode: mode, logLevel: logLevel_js_1.logLevels.info }, current);
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
//# sourceMappingURL=store.js.map
|
package/cjs/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../ts/store.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,6CAA0C;AAC1C,+EAA0E;AAC1E,6CAAyC;AAG5B,QAAA,KAAK,GAAG,IAAA,0BAAW,EAAW;IACzC,UAAU,EAAE,cAAc;IAC1B,GAAG,EAAE,sCAAsC;IAC3C,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,UAAC,OAAO;QACnB,IAAM,IAAI,GAAG,IAAA,wDAAyB,GAAE,IAAI,YAAY,CAAA;QACxD,kBACE,0BAA0B,EAAE,EAAE,EAC9B,UAAU,EAAE,KAAK,EACjB,cAAc,EAAE,EAAE,EAClB,SAAS,EAAE,EAAE,EACb,SAAS,EAAE,EAAE,EACb,YAAY,EAAE,EAAE,EAChB,mBAAmB,EAAE,EAAE,EACvB,IAAI,MAAA,EACJ,QAAQ,EAAE,uBAAS,CAAC,IAAI,IACrB,OAAO,EACX;IACH,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { createStore } from 'global-store'\nimport { getLogModeFromEnvironment } from './getLogModeFromEnvironment.js'\nimport { logLevels } from './logLevel.js'\nimport { LogStore } from './typesInternal.js'\n\nexport const store = createStore<LogStore>({\n moduleName: 'standard-log',\n key: 'e53d0937-f420-40a0-9901-099725fa4a53',\n version: '2.0.0',\n initializer: (current) => {\n const mode = getLogModeFromEnvironment() || 'production'\n return {\n addCustomLogLevelListeners: [],\n configured: false,\n loggerClosures: {},\n redirects: {},\n reporters: [],\n customLevels: {},\n customLevelsReverse: [],\n mode,\n logLevel: logLevels.info,\n ...current\n }\n }\n})\n"]}
|