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/esm/logReporter.spec.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import a from 'assertron';
|
|
2
|
-
import { addLogReporter, clearLogReporters, config, createConsoleLogReporter, createMemoryLogReporter, getConsoleReporter, getLogReporter, hasConsoleReporter, logLevels, ProhibitedDuringProduction } from './index.js';
|
|
3
|
-
import { store } from './store.js';
|
|
4
|
-
import { assertSSF } from './testUtil.js';
|
|
5
|
-
describe('production checks', () => {
|
|
6
|
-
beforeEach(() => store.reset());
|
|
7
|
-
describe('addLogReporter()', () => {
|
|
8
|
-
test('throws in production mode', () => {
|
|
9
|
-
config({ mode: 'production' });
|
|
10
|
-
const reporter = createMemoryLogReporter();
|
|
11
|
-
a.throws(() => addLogReporter(reporter), ProhibitedDuringProduction);
|
|
12
|
-
});
|
|
13
|
-
it('throw with ssf at call site', () => {
|
|
14
|
-
config({ mode: 'production' });
|
|
15
|
-
const reporter = createMemoryLogReporter();
|
|
16
|
-
const err = a.throws(() => addLogReporter(reporter), ProhibitedDuringProduction);
|
|
17
|
-
assertSSF(err, __filename);
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
describe('clearLogReporters()', () => {
|
|
21
|
-
test('throws in production mode', () => {
|
|
22
|
-
config({ mode: 'production' });
|
|
23
|
-
a.throws(() => clearLogReporters(), ProhibitedDuringProduction);
|
|
24
|
-
});
|
|
25
|
-
it('throw with ssf at call site', () => {
|
|
26
|
-
config({ mode: 'production' });
|
|
27
|
-
const err = a.throws(() => clearLogReporters(), ProhibitedDuringProduction);
|
|
28
|
-
assertSSF(err, __filename);
|
|
29
|
-
});
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
describe('unit tests', () => {
|
|
33
|
-
beforeEach(() => {
|
|
34
|
-
store.reset();
|
|
35
|
-
config({ mode: 'test' });
|
|
36
|
-
});
|
|
37
|
-
describe('addLogReporter()', () => {
|
|
38
|
-
test('adds log reporter', () => {
|
|
39
|
-
const count = store.value.reporters.length;
|
|
40
|
-
const reporter = createMemoryLogReporter();
|
|
41
|
-
addLogReporter(reporter);
|
|
42
|
-
expect(store.value.reporters.length).toBe(count + 1);
|
|
43
|
-
});
|
|
44
|
-
describe('add another console reporter', () => {
|
|
45
|
-
test('will not replace existing one', () => {
|
|
46
|
-
expect(getLogReporter('console')).toBeDefined();
|
|
47
|
-
addLogReporter(createConsoleLogReporter({ id: 'c2' }));
|
|
48
|
-
expect(getLogReporter('c2')).toBeUndefined();
|
|
49
|
-
expect(getLogReporter('console')).toBeDefined();
|
|
50
|
-
});
|
|
51
|
-
test('will carry over existing filter', () => {
|
|
52
|
-
const filter = entry => entry.level < logLevels.alert;
|
|
53
|
-
addLogReporter(createConsoleLogReporter({ id: 'c2', filter }));
|
|
54
|
-
addLogReporter(createConsoleLogReporter({ id: 'c3' }));
|
|
55
|
-
const c3 = getConsoleReporter();
|
|
56
|
-
expect(c3.filter).toBe(filter);
|
|
57
|
-
});
|
|
58
|
-
test('will combine existing filter and new filter', () => {
|
|
59
|
-
addLogReporter(createConsoleLogReporter({ id: 'c2', filter: entry => entry.level > logLevels.critical }));
|
|
60
|
-
addLogReporter(createConsoleLogReporter({ id: 'c3', filter: entry => entry.level < logLevels.error }));
|
|
61
|
-
const c2 = getConsoleReporter();
|
|
62
|
-
expect(c2.filter({ level: logLevels.info })).toBe(false);
|
|
63
|
-
expect(c2.filter({ level: logLevels.alert })).toBe(false);
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
});
|
|
67
|
-
describe('getLogReporter()', () => {
|
|
68
|
-
test('get log reporter by id', () => {
|
|
69
|
-
expect(getLogReporter('console')).toBeDefined();
|
|
70
|
-
});
|
|
71
|
-
test('get log reporter with unknown id gets undefined', () => {
|
|
72
|
-
expect(getLogReporter('blah')).toBeUndefined();
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
describe('clearLogReporters()', () => {
|
|
76
|
-
test('removes all reporters', () => {
|
|
77
|
-
clearLogReporters();
|
|
78
|
-
expect(store.value.reporters.length).toBe(0);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
describe('hasConsoleReporter()', () => {
|
|
82
|
-
test('returns true if there is a console reporter', () => {
|
|
83
|
-
expect(hasConsoleReporter()).toBeTruthy();
|
|
84
|
-
});
|
|
85
|
-
test('returns false if there is no console reporter', () => {
|
|
86
|
-
clearLogReporters();
|
|
87
|
-
expect(hasConsoleReporter()).toBeFalsy();
|
|
88
|
-
addLogReporter(createMemoryLogReporter());
|
|
89
|
-
expect(hasConsoleReporter()).toBeFalsy();
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
//# sourceMappingURL=logReporter.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logReporter.spec.js","sourceRoot":"","sources":["../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,uBAAuB,EAAE,CAAC,CAAA;YACzC,MAAM,CAAC,kBAAkB,EAAE,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,19 +0,0 @@
|
|
|
1
|
-
import { getConsoleReporter } from './logReporter.js';
|
|
2
|
-
import { store } from './store.js';
|
|
3
|
-
export function addLogReporterInternal(reporter) {
|
|
4
|
-
if (reporter.isConsoleReporter) {
|
|
5
|
-
const r = getConsoleReporter();
|
|
6
|
-
if (r && reporter.filter) {
|
|
7
|
-
const f = r.filter;
|
|
8
|
-
const f2 = reporter.filter;
|
|
9
|
-
if (f)
|
|
10
|
-
r.filter = entry => f(entry) && f2(entry);
|
|
11
|
-
else
|
|
12
|
-
r.filter = f2;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
else {
|
|
16
|
-
store.value.reporters.push(reporter);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=logReporterInternal.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logReporterInternal.js","sourceRoot":"","sources":["../ts/logReporterInternal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC,MAAM,UAAU,sBAAsB,CAAC,QAAqB;IAC1D,IAAI,QAAQ,CAAC,iBAAiB,EAAE;QAC9B,MAAM,CAAC,GAAG,kBAAkB,EAAE,CAAA;QAC9B,IAAI,CAAC,IAAI,QAAQ,CAAC,MAAM,EAAE;YACxB,MAAM,CAAC,GAAG,CAAC,CAAC,MAAM,CAAA;YAClB,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAA;YAC1B,IAAI,CAAC;gBAAE,CAAC,CAAC,MAAM,GAAG,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAA;;gBAC3C,CAAC,CAAC,MAAM,GAAG,EAAE,CAAA;SACnB;KACF;SACI;QACH,KAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;KACrC;AACH,CAAC","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,51 +0,0 @@
|
|
|
1
|
-
import { required } from 'type-plus';
|
|
2
|
-
import { formatLogLevel } from '../formatter/index.js';
|
|
3
|
-
import { assertLogModeIsNotProduction } from '../utils.js';
|
|
4
|
-
import { toInspectLogEntry } from './toInspectStringForObject.js';
|
|
5
|
-
function createGetLogMessage() {
|
|
6
|
-
return function getLogMessage() {
|
|
7
|
-
return this.logs.map(toInspectLogEntry)
|
|
8
|
-
.map(log => log.args.join(' '))
|
|
9
|
-
.join('\n');
|
|
10
|
-
};
|
|
11
|
-
}
|
|
12
|
-
export function toMessageWithLevel(logs) {
|
|
13
|
-
return logs.map(toInspectLogEntry)
|
|
14
|
-
.map(log => `${formatLogLevel(log.level)} ${log.args.join(' ')}`)
|
|
15
|
-
.join('\n')
|
|
16
|
-
// if it has more than this log,
|
|
17
|
-
// we assume it is running under tests,
|
|
18
|
-
// and remove this log to simplify testing.
|
|
19
|
-
.replace(/^\(WARN\) already configured for test, ignoring config\(\) call\n/, '');
|
|
20
|
-
}
|
|
21
|
-
export function createMemoryLogReporter(options) {
|
|
22
|
-
const opt = required({ id: 'memory', formatter: (e) => e }, options);
|
|
23
|
-
const { id } = opt;
|
|
24
|
-
let { formatter, filter } = opt;
|
|
25
|
-
return {
|
|
26
|
-
id,
|
|
27
|
-
get formatter() {
|
|
28
|
-
return formatter;
|
|
29
|
-
},
|
|
30
|
-
set formatter(value) {
|
|
31
|
-
assertLogModeIsNotProduction('set Reporter.formatter', Object.getOwnPropertyDescriptor(this, 'formatter').set);
|
|
32
|
-
formatter = value;
|
|
33
|
-
},
|
|
34
|
-
get filter() {
|
|
35
|
-
return filter;
|
|
36
|
-
},
|
|
37
|
-
set filter(value) {
|
|
38
|
-
assertLogModeIsNotProduction('set Reporter.filter', Object.getOwnPropertyDescriptor(this, 'filter').set);
|
|
39
|
-
filter = value;
|
|
40
|
-
},
|
|
41
|
-
logs: [],
|
|
42
|
-
write(entry) {
|
|
43
|
-
if (filter && !filter(entry))
|
|
44
|
-
return;
|
|
45
|
-
this.logs.push(formatter(entry));
|
|
46
|
-
},
|
|
47
|
-
getLogMessage: createGetLogMessage(),
|
|
48
|
-
getLogMessageWithLevel() { return toMessageWithLevel(this.logs); }
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
//# sourceMappingURL=MemoryLogReporter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryLogReporter.js","sourceRoot":"","sources":["../../ts/memory/MemoryLogReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAEtD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE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,CAAC;QACD,IAAI,MAAM;YACR,OAAO,MAAM,CAAA;QACf,CAAC;QACD,IAAI,MAAM,CAAC,KAAgB;YACzB,4BAA4B,CAC1B,qBAAqB,EACrB,MAAM,CAAC,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAE,CAAC,GAAI,CACtD,CAAA;YACD,MAAM,GAAG,KAAK,CAAA;QAChB,CAAC;QACD,IAAI,EAAE,EAAE;QACR,KAAK,CAAC,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,KAAK,OAAO,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC;KAClE,CAAA;AACH,CAAC","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,111 +0,0 @@
|
|
|
1
|
-
import a from 'assertron';
|
|
2
|
-
import { config, createMemoryLogReporter, logLevels, ProhibitedDuringProduction } from '../index.js';
|
|
3
|
-
import { configForTest } from '../configForTest.js';
|
|
4
|
-
import { getLogger } from '../getLogger.js';
|
|
5
|
-
import { store } from '../store.js';
|
|
6
|
-
import { assertSSF } from '../testUtil.js';
|
|
7
|
-
describe('production checks', () => {
|
|
8
|
-
beforeEach(() => store.reset());
|
|
9
|
-
test('set formatter in production mode throws', () => {
|
|
10
|
-
config({ mode: 'production' });
|
|
11
|
-
const reporter = createMemoryLogReporter();
|
|
12
|
-
a.throws(() => { reporter.formatter = e => e; }, ProhibitedDuringProduction);
|
|
13
|
-
});
|
|
14
|
-
it('set formatter throws with ssf at call site', () => {
|
|
15
|
-
config({ mode: 'production' });
|
|
16
|
-
const reporter = createMemoryLogReporter();
|
|
17
|
-
const err = a.throws(() => { reporter.formatter = e => e; }, ProhibitedDuringProduction);
|
|
18
|
-
assertSSF(err, __filename);
|
|
19
|
-
});
|
|
20
|
-
test('set filter in production mode throws', () => {
|
|
21
|
-
config({ mode: 'production' });
|
|
22
|
-
const reporter = createMemoryLogReporter();
|
|
23
|
-
a.throws(() => { reporter.filter = () => true; }, ProhibitedDuringProduction);
|
|
24
|
-
});
|
|
25
|
-
it('set filter throws with ssf at call site', () => {
|
|
26
|
-
config({ mode: 'production' });
|
|
27
|
-
const reporter = createMemoryLogReporter();
|
|
28
|
-
const err = a.throws(() => { reporter.filter = () => true; }, ProhibitedDuringProduction);
|
|
29
|
-
assertSSF(err, __filename);
|
|
30
|
-
});
|
|
31
|
-
describe('getLogMessageWithLevel()', () => {
|
|
32
|
-
test('the production log is omitted', () => {
|
|
33
|
-
const { reporter } = configForTest();
|
|
34
|
-
config({ mode: 'production' });
|
|
35
|
-
getLogger('test').warn('some test warnings');
|
|
36
|
-
expect(reporter.getLogMessageWithLevel()).toEqual(`(WARN) some test warnings`);
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
});
|
|
40
|
-
describe('unit tests', () => {
|
|
41
|
-
beforeEach(() => {
|
|
42
|
-
store.reset();
|
|
43
|
-
config({ mode: 'test' });
|
|
44
|
-
});
|
|
45
|
-
test('log entries are saved in the `logs` property', () => {
|
|
46
|
-
const reporter = createMemoryLogReporter();
|
|
47
|
-
const entry = { id: 'log', level: 1, args: ['some messages'], timestamp: new Date() };
|
|
48
|
-
reporter.write(entry);
|
|
49
|
-
expect(reporter.logs).toEqual([entry]);
|
|
50
|
-
});
|
|
51
|
-
test('can override id', () => {
|
|
52
|
-
const reporter = createMemoryLogReporter({ id: 'custom-id-mem' });
|
|
53
|
-
expect(reporter.id).toBe('custom-id-mem');
|
|
54
|
-
});
|
|
55
|
-
test('can filter', () => {
|
|
56
|
-
const reporter = createMemoryLogReporter({ filter(entry) { return entry.id !== 'secret'; } });
|
|
57
|
-
reporter.write({ id: 'ok', level: 1, args: ['some messages'], timestamp: new Date() });
|
|
58
|
-
reporter.write({ id: 'secret', level: 1, args: ['some messages'], timestamp: new Date() });
|
|
59
|
-
expect(reporter.logs.length).toBe(1);
|
|
60
|
-
});
|
|
61
|
-
test('can change filter', () => {
|
|
62
|
-
const reporter = createMemoryLogReporter();
|
|
63
|
-
const filter = reporter.filter;
|
|
64
|
-
reporter.filter = entry => entry.id !== 'secret';
|
|
65
|
-
expect(reporter.filter).not.toEqual(filter);
|
|
66
|
-
});
|
|
67
|
-
test('formatter can be used to pre-process the log', () => {
|
|
68
|
-
const reporter = createMemoryLogReporter({
|
|
69
|
-
formatter: (entry) => ({
|
|
70
|
-
...entry,
|
|
71
|
-
args: entry.args.map(arg => arg === 'secret' ? '<censored>' : arg)
|
|
72
|
-
})
|
|
73
|
-
});
|
|
74
|
-
const entry = { id: 'log', level: 1, args: ['a', 'secret', 'b'], timestamp: new Date() };
|
|
75
|
-
reporter.write(entry);
|
|
76
|
-
expect(reporter.logs[0].args[1]).toBe('<censored>');
|
|
77
|
-
});
|
|
78
|
-
test('can change formatter', () => {
|
|
79
|
-
const reporter = createMemoryLogReporter();
|
|
80
|
-
const formatter = reporter.formatter;
|
|
81
|
-
reporter.formatter = e => ({ ...e, args: e.args.reverse() });
|
|
82
|
-
expect(reporter.formatter).not.toEqual(formatter);
|
|
83
|
-
});
|
|
84
|
-
describe('getLogMessages()', () => {
|
|
85
|
-
test('empty logs returns empty string', () => {
|
|
86
|
-
const reporter = createMemoryLogReporter();
|
|
87
|
-
expect(reporter.getLogMessage()).toEqual('');
|
|
88
|
-
});
|
|
89
|
-
test('print args', () => {
|
|
90
|
-
const reporter = createMemoryLogReporter();
|
|
91
|
-
const entry = { id: 'log', level: 1, args: ['miku', 'is', 'singing'], timestamp: new Date() };
|
|
92
|
-
reporter.write(entry);
|
|
93
|
-
expect(reporter.getLogMessage()).toEqual('miku is singing');
|
|
94
|
-
});
|
|
95
|
-
test('print object arg', () => {
|
|
96
|
-
const reporter = createMemoryLogReporter();
|
|
97
|
-
const entry = { id: 'log', level: 1, args: [{ 'miku': 'sing' }], timestamp: new Date() };
|
|
98
|
-
reporter.write(entry);
|
|
99
|
-
expect(reporter.getLogMessage()).toEqual("{ miku: 'sing' }");
|
|
100
|
-
});
|
|
101
|
-
});
|
|
102
|
-
describe('getLogMessageWithLevel', () => {
|
|
103
|
-
test('print with level', () => {
|
|
104
|
-
const reporter = createMemoryLogReporter();
|
|
105
|
-
reporter.write({ id: 'log', level: logLevels.info, args: ['msg 1'], timestamp: new Date() });
|
|
106
|
-
reporter.write({ id: 'log', level: logLevels.warn, args: ['msg 2'], timestamp: new Date() });
|
|
107
|
-
expect(reporter.getLogMessageWithLevel()).toEqual(`(INFO) msg 1\n(WARN) msg 2`);
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
});
|
|
111
|
-
//# sourceMappingURL=MemoryLogReporter.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"MemoryLogReporter.spec.js","sourceRoot":"","sources":["../../ts/memory/MemoryLogReporter.spec.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,WAAW,CAAA;AACzB,OAAO,EAAE,MAAM,EAAE,uBAAuB,EAAE,SAAS,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAA;AACpG,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;IAC/B,IAAI,CAAC,yCAAyC,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,EA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AO,CAAC,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE,CAAC,CAAA;YAC5F,QAAQ,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,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/esm/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/esm/memory/index.js
DELETED
package/esm/memory/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/memory/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,wBAAwB,CAAA","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,6 +0,0 @@
|
|
|
1
|
-
import { plainLogFormatter } from '../formatter/index.js';
|
|
2
|
-
import { toInspectLogEntry } from './toInspectStringForObject.js';
|
|
3
|
-
export function logEntriesToString(logs) {
|
|
4
|
-
return logs.map(toInspectLogEntry).map(plainLogFormatter).join('\n');
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=logEntriesToString.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logEntriesToString.js","sourceRoot":"","sources":["../../ts/memory/logEntriesToString.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAA;AAEjE,MAAM,UAAU,kBAAkB,CAAC,IAAgB;IACjD,OAAO,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACtE,CAAC","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,42 +0,0 @@
|
|
|
1
|
-
import { logLevels, logEntriesToString } from '../index.js';
|
|
2
|
-
test('convert log entries to string', () => {
|
|
3
|
-
const timestamp = new Date(2019, 6);
|
|
4
|
-
const actual = logEntriesToString([
|
|
5
|
-
{ id: 'log', level: logLevels.emergency, args: ['emergency'], timestamp },
|
|
6
|
-
{ id: 'log', level: logLevels.critical, args: ['critical'], timestamp },
|
|
7
|
-
{ id: 'log', level: logLevels.alert, args: ['alert'], timestamp },
|
|
8
|
-
{ id: 'log', level: logLevels.error, args: ['error'], timestamp },
|
|
9
|
-
{ id: 'log', level: logLevels.warn, args: ['warn'], timestamp },
|
|
10
|
-
{ id: 'log', level: logLevels.notice, args: ['notice'], timestamp },
|
|
11
|
-
{ id: 'log', level: logLevels.info, args: ['info'], timestamp },
|
|
12
|
-
{ id: 'log', level: logLevels.debug, args: ['debug'], timestamp },
|
|
13
|
-
{ id: 'log', level: logLevels.trace, args: ['trace'], timestamp }
|
|
14
|
-
]);
|
|
15
|
-
const iso = timestamp.toISOString();
|
|
16
|
-
expect(actual).toEqual(`${iso},log,(EMERGENCY),emergency
|
|
17
|
-
${iso},log,(CRITICAL),critical
|
|
18
|
-
${iso},log,(ALERT),alert
|
|
19
|
-
${iso},log,(ERROR),error
|
|
20
|
-
${iso},log,(WARN),warn
|
|
21
|
-
${iso},log,(NOTICE),notice
|
|
22
|
-
${iso},log,(INFO),info
|
|
23
|
-
${iso},log,(DEBUG),debug
|
|
24
|
-
${iso},log,(TRACE),trace`);
|
|
25
|
-
});
|
|
26
|
-
test('print out object', () => {
|
|
27
|
-
const timestamp = new Date(2021, 4);
|
|
28
|
-
const actual = logEntriesToString([
|
|
29
|
-
{ id: 'log', level: logLevels.info, args: ['a', { a: 1 }], timestamp }
|
|
30
|
-
]);
|
|
31
|
-
const iso = timestamp.toISOString();
|
|
32
|
-
expect(actual).toEqual(`${iso},log,(INFO),a,{ a: 1 }`);
|
|
33
|
-
});
|
|
34
|
-
test('print out array', () => {
|
|
35
|
-
const timestamp = new Date(2021, 4);
|
|
36
|
-
const actual = logEntriesToString([
|
|
37
|
-
{ id: 'log', level: logLevels.info, args: ['a', [1, 2, 3]], timestamp }
|
|
38
|
-
]);
|
|
39
|
-
const iso = timestamp.toISOString();
|
|
40
|
-
expect(actual).toEqual(`${iso},log,(INFO),a,[ 1, 2, 3 ]`);
|
|
41
|
-
});
|
|
42
|
-
//# sourceMappingURL=logEntriesToString.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logEntriesToString.spec.js","sourceRoot":"","sources":["../../ts/memory/logEntriesToString.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAE3D,IAAI,CAAC,+B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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,11 +0,0 @@
|
|
|
1
|
-
import isNode from 'is-node';
|
|
2
|
-
export const toInspectLogEntry = isNode
|
|
3
|
-
? (() => {
|
|
4
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
5
|
-
const inspect = require('util').inspect;
|
|
6
|
-
return (e) => (e.args = e.args.map(value => typeof value === 'object' && value !== null ? inspect(value) : value),
|
|
7
|
-
e);
|
|
8
|
-
})()
|
|
9
|
-
// istanbul ignore next
|
|
10
|
-
: (e) => e;
|
|
11
|
-
//# sourceMappingURL=toInspectStringForObject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"toInspectStringForObject.js","sourceRoot":"","sources":["../../ts/memory/toInspectStringForObject.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAG5B,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM;IACrC,CAAC,CAAC,CAAC,GAAG,EAAE;QACN,8DAA8D;QAC9D,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAA;QACvC,OAAO,CAAC,CAAW,EAAE,EAAE,CAAC,CACtB,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAClG,CAAC,CAAC,CAAA;IACN,CAAC,CAAC,EAAE;IACJ,uBAAuB;IACvB,CAAC,CAAC,CAAC,CAAW,EAAE,EAAE,CAAC,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/esm/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/esm/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/esm/shouldLog.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { store } from './store.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 function shouldLog(targetLevel, loggerLevel) {
|
|
8
|
-
return targetLevel <= (loggerLevel !== undefined ? loggerLevel : store.value.logLevel);
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=shouldLog.js.map
|
package/esm/shouldLog.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shouldLog.js","sourceRoot":"","sources":["../ts/shouldLog.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC;;;;GAIG;AACH,MAAM,UAAU,SAAS,CAAC,WAAqB,EAAE,WAAiC;IAChF,OAAO,WAAW,IAAI,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAA;AACxF,CAAC","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/esm/store.d.ts
DELETED
package/esm/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/esm/store.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { createStore } from 'global-store';
|
|
2
|
-
import { getLogModeFromEnvironment } from './getLogModeFromEnvironment.js';
|
|
3
|
-
import { logLevels } from './logLevel.js';
|
|
4
|
-
export const store = createStore({
|
|
5
|
-
moduleName: 'standard-log',
|
|
6
|
-
key: 'e53d0937-f420-40a0-9901-099725fa4a53',
|
|
7
|
-
version: '2.0.0',
|
|
8
|
-
initializer: (current) => {
|
|
9
|
-
const mode = getLogModeFromEnvironment() || 'production';
|
|
10
|
-
return {
|
|
11
|
-
addCustomLogLevelListeners: [],
|
|
12
|
-
configured: false,
|
|
13
|
-
loggerClosures: {},
|
|
14
|
-
redirects: {},
|
|
15
|
-
reporters: [],
|
|
16
|
-
customLevels: {},
|
|
17
|
-
customLevelsReverse: [],
|
|
18
|
-
mode,
|
|
19
|
-
logLevel: logLevels.info,
|
|
20
|
-
...current
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
//# sourceMappingURL=store.js.map
|
package/esm/store.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../ts/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAGzC,MAAM,CAAC,MAAM,KAAK,GAAG,WAAW,CAAW;IACzC,UAAU,EAAE,cAAc;IAC1B,GAAG,EAAE,sCAAsC;IAC3C,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,yBAAyB,EAAE,IAAI,YAAY,CAAA;QACxD,OAAO;YACL,0BAA0B,EAAE,EAAE;YAC9B,UAAU,EAAE,KAAK;YACjB,cAAc,EAAE,EAAE;YAClB,SAAS,EAAE,EAAE;YACb,SAAS,EAAE,EAAE;YACb,YAAY,EAAE,EAAE;YAChB,mBAAmB,EAAE,EAAE;YACvB,IAAI;YACJ,QAAQ,EAAE,SAAS,CAAC,IAAI;YACxB,GAAG,OAAO;SACX,CAAA;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"]}
|
package/esm/suppressLogs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suppressLogs.d.ts","sourceRoot":"","sources":["../ts/suppressLogs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAEnC;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,CAAA"}
|
package/esm/suppressLogs.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { logLevels } from './logLevel.js';
|
|
2
|
-
export function suppressLogs(block, ...logs) {
|
|
3
|
-
const origLevels = logs.map(l => l.level);
|
|
4
|
-
logs.forEach(l => l.level = logLevels.none);
|
|
5
|
-
const result = block();
|
|
6
|
-
logs.forEach((l, i) => l.level = origLevels[i]);
|
|
7
|
-
return result;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=suppressLogs.js.map
|
package/esm/suppressLogs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suppressLogs.js","sourceRoot":"","sources":["../ts/suppressLogs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAOzC,MAAM,UAAU,YAAY,CAAI,KAAc,EAAE,GAAG,IAAc;IAC/D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IACzC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,CAAA;IAC3C,MAAM,MAAM,GAAG,KAAK,EAAE,CAAA;IACtB,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAC/C,OAAO,MAAM,CAAA;AACf,CAAC","sourcesContent":["import { logLevels } from './logLevel.js'\nimport { Logger } from './types.js'\n\n/**\n * Suppress logging within the code block.\n */\nexport function suppressLogs<R>(block: () => R, log: Logger, ...logs: Logger[]): R\nexport function suppressLogs<R>(block: () => R, ...logs: Logger[]): R {\n const origLevels = logs.map(l => l.level)\n logs.forEach(l => l.level = logLevels.none)\n const result = block()\n logs.forEach((l, i) => l.level = origLevels[i])\n return result\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"suppressLogs.spec.d.ts","sourceRoot":"","sources":["../ts/suppressLogs.spec.ts"],"names":[],"mappings":""}
|