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/ts/platform.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { inspect } from 'util'
|
|
2
|
+
import type { ConsoleLike, LogEntry } from './types.js'
|
|
3
|
+
|
|
4
|
+
export const toInspectLogEntry = (e: LogEntry) => (
|
|
5
|
+
e.args = e.args.map(value => typeof value === 'object' && value !== null ? inspect(value) : value),
|
|
6
|
+
e)
|
|
7
|
+
|
|
8
|
+
export const polyfill: { console?: ConsoleLike } = {}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { StackTraceMeta } from '@just-func/types'
|
|
2
|
+
import { required } from 'type-plus'
|
|
3
|
+
import { createLogger } from './logger.js'
|
|
4
|
+
import { logLevels } from './logLevels.js'
|
|
5
|
+
import { createLogStore, LogStore } from './logStore.js'
|
|
6
|
+
import { createMemoryLogReporter } from './memory.js'
|
|
7
|
+
import type { Logger, LoggerOptions, LogLevel, LogMethodNames, StandardLogOptions } from './types.js'
|
|
8
|
+
|
|
9
|
+
export interface StandardLogInstance<N extends string = LogMethodNames> {
|
|
10
|
+
logLevel: number,
|
|
11
|
+
toLogLevelName(level: number): string,
|
|
12
|
+
toLogLevel(name: N): number,
|
|
13
|
+
getLogger(params: [id: string, options?: LoggerOptions], meta?: StackTraceMeta): Logger<N | LogMethodNames>
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface StandardLog<N extends string = LogMethodNames> extends Readonly<StandardLogInstance<N>> {
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function createStandardLog<N extends string = LogMethodNames>(
|
|
20
|
+
options?: StandardLogOptions<N>
|
|
21
|
+
): StandardLog<N> {
|
|
22
|
+
return createStandardLogClosure(options).standardLog
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function createStandardLogClosure<N extends string = LogMethodNames>(
|
|
26
|
+
options?: StandardLogOptions<N>
|
|
27
|
+
): { store: LogStore, standardLog: StandardLog<N> } {
|
|
28
|
+
const store = createLogStore(required({ logLevel: logLevels.info }, options))
|
|
29
|
+
|
|
30
|
+
return {
|
|
31
|
+
store,
|
|
32
|
+
standardLog: {
|
|
33
|
+
get logLevel() { return store.logLevel },
|
|
34
|
+
|
|
35
|
+
toLogLevelName(level: number) {
|
|
36
|
+
return store.logLevelStore.getName(level)
|
|
37
|
+
},
|
|
38
|
+
toLogLevel(name: string) {
|
|
39
|
+
return store.logLevelStore.getLevel(name)
|
|
40
|
+
},
|
|
41
|
+
getLogger([id, options]: [id: string, options?: LoggerOptions], meta?: StackTraceMeta) {
|
|
42
|
+
if (store.loggers[id]) return store.loggers[id] as any
|
|
43
|
+
return store.loggers[id] = createLogger([store, id, options], { ssf: this.getLogger, ...meta }) as any
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function createStandardLogForTest(logLevel: LogLevel = logLevels.debug) {
|
|
50
|
+
const reporter = createMemoryLogReporter()
|
|
51
|
+
const standardLog = createStandardLog({ reporters: [reporter], logLevel })
|
|
52
|
+
return { ...standardLog, reporter }
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Suppress logging within the code block.
|
|
57
|
+
*/
|
|
58
|
+
export function suppressLogs<R>(block: () => R, log: Logger, ...logs: Logger[]): R
|
|
59
|
+
export function suppressLogs<R>(block: () => R, ...logs: Logger[]): R {
|
|
60
|
+
const origLevels = logs.map(l => l.level)
|
|
61
|
+
logs.forEach(l => l.level = logLevels.none)
|
|
62
|
+
const result = block()
|
|
63
|
+
logs.forEach((l, i) => l.level = origLevels[i])
|
|
64
|
+
return result
|
|
65
|
+
}
|
package/ts/types.ts
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
|
+
export type StandardLogOptions<CustomLevelNames extends string = string> = {
|
|
2
|
+
customLevels?: Record<CustomLevelNames, number>,
|
|
3
|
+
logLevel?: number,
|
|
4
|
+
reporters?: LogReporter[]
|
|
5
|
+
}
|
|
1
6
|
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export type LogMethod = (...args: any[]) => void
|
|
6
|
-
export type LogFunction = ((log: LogMethod) => void) | (() => string)
|
|
7
|
-
|
|
8
|
-
export type LogEntry = {
|
|
9
|
-
id: string,
|
|
10
|
-
level: number,
|
|
11
|
-
// args instead of messages because it is `any[]` instead of `string[]`
|
|
12
|
-
args: any[],
|
|
13
|
-
timestamp: Date
|
|
7
|
+
export interface LoggerOptions {
|
|
8
|
+
level?: number,
|
|
9
|
+
writeTo?: LogReporter | ReporterFilter
|
|
14
10
|
}
|
|
15
11
|
|
|
16
12
|
export type Logger<T extends string = LogMethodNames> = {
|
|
@@ -27,19 +23,33 @@ export type Logger<T extends string = LogMethodNames> = {
|
|
|
27
23
|
on(level: number | T, logFunction: LogFunction): void,
|
|
28
24
|
/**
|
|
29
25
|
* Write custom log entries.
|
|
30
|
-
* This can be used along with `captureLogs()` to rewrite the logs at a later time.
|
|
31
26
|
*/
|
|
32
27
|
write(entry: LogEntry): void
|
|
33
|
-
} & {
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
} & { [k in T]: LogMethod }
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Names of the standard log methods.
|
|
32
|
+
*/
|
|
33
|
+
export type LogMethodNames = 'emergency' | 'alert' | 'critical' | 'error' | 'warn' | 'notice' | 'info' | 'debug' | 'trace' | 'planck'
|
|
34
|
+
|
|
35
|
+
export type LogEntry = {
|
|
36
|
+
id: string,
|
|
37
|
+
level: number,
|
|
38
|
+
// args instead of messages because it is `any[]` instead of `string[]`
|
|
39
|
+
args: any[],
|
|
40
|
+
timestamp: Date
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type LogMethod = (...args: any[]) => void
|
|
44
|
+
|
|
45
|
+
export type LogFunction = ((log: LogMethod) => void) | (() => string)
|
|
36
46
|
|
|
37
47
|
export type ReporterFilter = string | RegExp | ((reporterId: string) => boolean)
|
|
38
48
|
|
|
39
49
|
/**
|
|
40
50
|
* Formats a log entry.
|
|
41
51
|
* Depends on the reporter, it can expect a different return type.
|
|
42
|
-
* By default the return type is `any[]` which `console` accepts.
|
|
52
|
+
* By default the return type is `any[]` which the `console` accepts.
|
|
43
53
|
*/
|
|
44
54
|
export type LogFormatter<T = any[]> = (entry: LogEntry) => T
|
|
45
55
|
|
|
@@ -50,30 +60,22 @@ export type LogFilter = (entry: LogEntry) => boolean
|
|
|
50
60
|
|
|
51
61
|
export type LogLevelEntry = { name: string, level: number }
|
|
52
62
|
|
|
53
|
-
export
|
|
54
|
-
|
|
55
|
-
export type LogReporter<T = any> = {
|
|
56
|
-
id: string,
|
|
63
|
+
export interface LogReporter<T = any> {
|
|
64
|
+
readonly id: string,
|
|
57
65
|
/**
|
|
58
66
|
* Specifies the formatter to be used by the reporter.
|
|
59
67
|
* Using this you can customize how the reporter writes the log entry.
|
|
60
|
-
* This is readonly in production mode.
|
|
61
68
|
*/
|
|
62
|
-
formatter: LogFormatter<T>,
|
|
69
|
+
readonly formatter: LogFormatter<T>,
|
|
63
70
|
/**
|
|
64
71
|
* Specifies a filter to determine should the log be written.
|
|
65
|
-
* This is readonly in production mode.
|
|
66
72
|
*/
|
|
67
|
-
filter?: LogFilter,
|
|
73
|
+
readonly filter?: LogFilter,
|
|
68
74
|
/**
|
|
69
75
|
* Indicate if this is a console reporter.
|
|
70
76
|
* There is only one console reporter can be present in the system.
|
|
71
|
-
* If a new console reporter is added,
|
|
72
|
-
* it will be used in place of the existing one.
|
|
73
|
-
* However, existing filter will be carried over to ensure logs should not be shown remain not shown.
|
|
74
|
-
* If the new reporter also contains a filter, they will be combined.
|
|
75
77
|
*/
|
|
76
|
-
isConsoleReporter?: boolean,
|
|
78
|
+
readonly isConsoleReporter?: boolean,
|
|
77
79
|
write(entry: LogEntry): void
|
|
78
80
|
}
|
|
79
81
|
|
|
@@ -91,3 +93,10 @@ export type LogReporterOptions<T = any> = {
|
|
|
91
93
|
}
|
|
92
94
|
|
|
93
95
|
export type LogLevel = number
|
|
96
|
+
|
|
97
|
+
export interface ConsoleLike {
|
|
98
|
+
debug(...args: any[]): void,
|
|
99
|
+
info(...args: any[]): void,
|
|
100
|
+
warn(...args: any[]): void,
|
|
101
|
+
error(...args: any[]): void,
|
|
102
|
+
}
|
package/cjs/LogEntry.d.ts
DELETED
package/cjs/LogEntry.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogEntry.d.ts","sourceRoot":"","sources":["../ts/LogEntry.ts"],"names":[],"mappings":"AAAA,oBAAY,QAAQ,GAAG;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IAEd,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,SAAS,EAAE,IAAI,CAAA;CAChB,CAAA"}
|
package/cjs/LogEntry.js
DELETED
package/cjs/LogEntry.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LogEntry.js","sourceRoot":"","sources":["../ts/LogEntry.ts"],"names":[],"mappings":"","sourcesContent":["export type LogEntry = {\n id: string,\n level: number,\n // args instead of messages because it is `any[]` instead of `string[]`\n args: any[],\n timestamp: Date\n}\n"]}
|
package/cjs/captureLogs.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { LogEntry, Logger } from './types.js';
|
|
2
|
-
export declare function captureLogs<R>(logger: Logger, funcBlock: () => Promise<R>): Promise<[R, LogEntry[]]>;
|
|
3
|
-
export declare function captureLogs<R>(logger: Logger, funcBlock: () => R): [R, LogEntry[]];
|
|
4
|
-
//# sourceMappingURL=captureLogs.d.ts.map
|
package/cjs/captureLogs.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captureLogs.d.ts","sourceRoot":"","sources":["../ts/captureLogs.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAe,MAAM,YAAY,CAAA;AAE1D,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAA;AACrG,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAA"}
|
package/cjs/captureLogs.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.captureLogs = void 0;
|
|
4
|
-
var type_plus_1 = require("type-plus");
|
|
5
|
-
var index_js_1 = require("./memory/index.js");
|
|
6
|
-
var store_js_1 = require("./store.js");
|
|
7
|
-
function captureLogs(logger, funcBlock) {
|
|
8
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
9
|
-
addRedirect(logger.id, reporter);
|
|
10
|
-
try {
|
|
11
|
-
var result = funcBlock();
|
|
12
|
-
if ((0, type_plus_1.isPromise)(result)) {
|
|
13
|
-
return result.then(function (r) { return [r, reporter.logs]; })
|
|
14
|
-
.finally(function () { return removeRedirect(logger.id, reporter); });
|
|
15
|
-
}
|
|
16
|
-
removeRedirect(logger.id, reporter);
|
|
17
|
-
return [result, reporter.logs];
|
|
18
|
-
}
|
|
19
|
-
catch (e) {
|
|
20
|
-
removeRedirect(logger.id, reporter);
|
|
21
|
-
throw e;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.captureLogs = captureLogs;
|
|
25
|
-
function addRedirect(id, reporter) {
|
|
26
|
-
var redirect = store_js_1.store.value.redirects[id] || [];
|
|
27
|
-
redirect.push(reporter);
|
|
28
|
-
store_js_1.store.value.redirects[id] = redirect;
|
|
29
|
-
}
|
|
30
|
-
function removeRedirect(id, reporter) {
|
|
31
|
-
store_js_1.store.value.redirects[id] = store_js_1.store.value.redirects[id].filter(function (r) { return r !== reporter; });
|
|
32
|
-
}
|
|
33
|
-
//# sourceMappingURL=captureLogs.js.map
|
package/cjs/captureLogs.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captureLogs.js","sourceRoot":"","sources":["../ts/captureLogs.ts"],"names":[],"mappings":";;;AAAA,uCAAkD;AAClD,8CAA2D;AAC3D,uCAAkC;AAKlC,SAAgB,WAAW,CAAC,MAAc,EAAE,SAAsB;IAChE,IAAM,QAAQ,GAAG,IAAA,kCAAuB,GAAE,CAAA;IAC1C,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;IAEhC,IAAI;QACF,IAAM,MAAM,GAAG,SAAS,EAAE,CAAA;QAC1B,IAAI,IAAA,qBAAS,EAAC,MAAM,CAAC,EAAE;YACrB,OAAO,MAAM,CAAC,IAAI,CAAC,UAAC,CAAC,IAAK,OAAA,CAAC,CAAC,EAAE,QAAQ,CAAC,IAAI,CAAC,EAAlB,CAAkB,CAAC;iBAC1C,OAAO,CAAC,cAAM,OAAA,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,EAAnC,CAAmC,CAAC,CAAA;SACtD;QACD,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;QACnC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAA;KAC/B;IACD,OAAO,CAAC,EAAE;QACR,cAAc,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAA;QACnC,MAAM,CAAC,CAAA;KACR;AACH,CAAC;AAjBD,kCAiBC;AAED,SAAS,WAAW,CAAC,EAAU,EAAE,QAAqB;IACpD,IAAM,QAAQ,GAAG,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,CAAA;IAChD,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IACvB,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAA;AACtC,CAAC;AAED,SAAS,cAAc,CAAC,EAAU,EAAE,QAAqB;IACvD,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,KAAK,QAAQ,EAAd,CAAc,CAAC,CAAA;AACnF,CAAC","sourcesContent":["import { AnyFunction, isPromise } from 'type-plus'\nimport { createMemoryLogReporter } from './memory/index.js'\nimport { store } from './store.js'\nimport { LogEntry, Logger, LogReporter } from './types.js'\n\nexport function captureLogs<R>(logger: Logger, funcBlock: () => Promise<R>): Promise<[R, LogEntry[]]>\nexport function captureLogs<R>(logger: Logger, funcBlock: () => R): [R, LogEntry[]]\nexport function captureLogs(logger: Logger, funcBlock: AnyFunction) {\n const reporter = createMemoryLogReporter()\n addRedirect(logger.id, reporter)\n\n try {\n const result = funcBlock()\n if (isPromise(result)) {\n return result.then((r) => [r, reporter.logs])\n .finally(() => removeRedirect(logger.id, reporter))\n }\n removeRedirect(logger.id, reporter)\n return [result, reporter.logs]\n }\n catch (e) {\n removeRedirect(logger.id, reporter)\n throw e\n }\n}\n\nfunction addRedirect(id: string, reporter: LogReporter) {\n const redirect = store.value.redirects[id] || []\n redirect.push(reporter)\n store.value.redirects[id] = redirect\n}\n\nfunction removeRedirect(id: string, reporter: LogReporter) {\n store.value.redirects[id] = store.value.redirects[id].filter(r => r !== reporter)\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captureLogs.spec.d.ts","sourceRoot":"","sources":["../ts/captureLogs.spec.ts"],"names":[],"mappings":""}
|
package/cjs/captureLogs.spec.js
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (_) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var assertron_1 = __importDefault(require("assertron"));
|
|
43
|
-
var delay_1 = __importDefault(require("delay"));
|
|
44
|
-
var index_js_1 = require("./index.js");
|
|
45
|
-
var index_js_2 = require("./memory/index.js");
|
|
46
|
-
var store_js_1 = require("./store.js");
|
|
47
|
-
describe('captureLogs()', function () {
|
|
48
|
-
test('gets empty object if no log are written', function () {
|
|
49
|
-
var log = (0, index_js_1.getLogger)('capture');
|
|
50
|
-
var _a = (0, index_js_1.captureLogs)(log, function () { }), actual = _a[1];
|
|
51
|
-
expect(actual).toEqual([]);
|
|
52
|
-
});
|
|
53
|
-
test('gets logs', function () {
|
|
54
|
-
var log = (0, index_js_1.getLogger)('capture');
|
|
55
|
-
var _a = (0, index_js_1.captureLogs)(log, function () { return log.error('err msg'); }), actual = _a[1];
|
|
56
|
-
expect((0, index_js_2.toMessageWithLevel)(actual)).toEqual('(ERROR) err msg');
|
|
57
|
-
assertron_1.default.satisfies(actual, [{ args: ['err msg'] }]);
|
|
58
|
-
});
|
|
59
|
-
test('get logs for async block', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
60
|
-
var log, _a, actual;
|
|
61
|
-
return __generator(this, function (_b) {
|
|
62
|
-
switch (_b.label) {
|
|
63
|
-
case 0:
|
|
64
|
-
log = (0, index_js_1.getLogger)('capture');
|
|
65
|
-
return [4 /*yield*/, (0, index_js_1.captureLogs)(log, function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0: return [4 /*yield*/, (0, delay_1.default)(1)];
|
|
69
|
-
case 1:
|
|
70
|
-
_a.sent();
|
|
71
|
-
log.error('err msg');
|
|
72
|
-
return [2 /*return*/];
|
|
73
|
-
}
|
|
74
|
-
});
|
|
75
|
-
}); })];
|
|
76
|
-
case 1:
|
|
77
|
-
_a = _b.sent(), actual = _a[1];
|
|
78
|
-
assertron_1.default.satisfies(actual, [{ args: ['err msg'] }]);
|
|
79
|
-
return [2 /*return*/];
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}); });
|
|
83
|
-
test('redirect is reset even if the block throws', function () {
|
|
84
|
-
var log = (0, index_js_1.getLogger)('capture');
|
|
85
|
-
assertron_1.default.throws(function () { return (0, index_js_1.captureLogs)(log, function () { throw new Error('some error'); }); });
|
|
86
|
-
expect(store_js_1.store.value.redirects[log.id].length).toBe(0);
|
|
87
|
-
});
|
|
88
|
-
test('redirect is reset even if the block rejects', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
-
var log;
|
|
90
|
-
return __generator(this, function (_a) {
|
|
91
|
-
switch (_a.label) {
|
|
92
|
-
case 0:
|
|
93
|
-
log = (0, index_js_1.getLogger)('capture');
|
|
94
|
-
return [4 /*yield*/, assertron_1.default.throws(function () { return (0, index_js_1.captureLogs)(log, function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
95
|
-
return __generator(this, function (_a) {
|
|
96
|
-
switch (_a.label) {
|
|
97
|
-
case 0: return [4 /*yield*/, (0, delay_1.default)(1)];
|
|
98
|
-
case 1:
|
|
99
|
-
_a.sent();
|
|
100
|
-
throw new Error('some error');
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}); }); })];
|
|
104
|
-
case 1:
|
|
105
|
-
_a.sent();
|
|
106
|
-
expect(store_js_1.store.value.redirects[log.id].length).toBe(0);
|
|
107
|
-
return [2 /*return*/];
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
}); });
|
|
111
|
-
test('receive sync result', function () {
|
|
112
|
-
var log = (0, index_js_1.getLogger)('capture');
|
|
113
|
-
var a = (0, index_js_1.captureLogs)(log, function () { return 123; })[0];
|
|
114
|
-
expect(a).toEqual(123);
|
|
115
|
-
});
|
|
116
|
-
});
|
|
117
|
-
//# sourceMappingURL=captureLogs.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"captureLogs.spec.js","sourceRoot":"","sources":["../ts/captureLogs.spec.ts"],"names":[],"mappings":"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","sourcesContent":["import a from 'assertron'\nimport delay from 'delay'\nimport { captureLogs, getLogger } from './index.js'\nimport { toMessageWithLevel } from './memory/index.js'\nimport { store } from './store.js'\n\ndescribe('captureLogs()', () => {\n test('gets empty object if no log are written', () => {\n const log = getLogger('capture')\n const [, actual] = captureLogs(log, () => { })\n\n expect(actual).toEqual([])\n })\n\n test('gets logs', () => {\n const log = getLogger('capture')\n const [, actual] = captureLogs(log, () => log.error('err msg'))\n\n expect(toMessageWithLevel(actual)).toEqual('(ERROR) err msg')\n a.satisfies(actual, [{ args: ['err msg'] }])\n })\n\n test('get logs for async block', async () => {\n const log = getLogger('capture')\n const [, actual] = await captureLogs(log, async () => {\n await delay(1)\n log.error('err msg')\n })\n a.satisfies(actual, [{ args: ['err msg'] }])\n })\n\n test('redirect is reset even if the block throws', () => {\n const log = getLogger('capture')\n a.throws(() => captureLogs(log, () => { throw new Error('some error') }))\n expect(store.value.redirects[log.id].length).toBe(0)\n })\n\n test('redirect is reset even if the block rejects', async () => {\n const log = getLogger('capture')\n await a.throws(() => captureLogs(log, async () => {\n await delay(1)\n throw new Error('some error')\n }))\n expect(store.value.redirects[log.id].length).toBe(0)\n })\n\n test('receive sync result', () => {\n const log = getLogger('capture')\n const [a] = captureLogs(log, () => 123)\n expect(a).toEqual(123)\n })\n})\n"]}
|
package/cjs/config.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { LogMode, LogReporter } from './types.js';
|
|
2
|
-
export declare type ConfigOptions = {
|
|
3
|
-
mode: LogMode;
|
|
4
|
-
customLevels: Record<string, number>;
|
|
5
|
-
logLevel: number;
|
|
6
|
-
reporters: LogReporter[];
|
|
7
|
-
};
|
|
8
|
-
export declare const config: {
|
|
9
|
-
(options?: Partial<ConfigOptions>): void;
|
|
10
|
-
readonly isLocked: boolean;
|
|
11
|
-
};
|
|
12
|
-
//# sourceMappingURL=config.d.ts.map
|
package/cjs/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../ts/config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAEjD,oBAAY,aAAa,GAAG;IAC1B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,WAAW,EAAE,CAAA;CACzB,CAAA;AAED,eAAO,MAAM,MAAM,EAAE;IAAE,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAA;CAgCnF,CAAA"}
|
package/cjs/config.js
DELETED
|
@@ -1,59 +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.config = void 0;
|
|
15
|
-
var type_plus_1 = require("type-plus");
|
|
16
|
-
var customLogLevel_js_1 = require("./customLogLevel.js");
|
|
17
|
-
var errors_js_1 = require("./errors.js");
|
|
18
|
-
var getDefaultReporter_js_1 = require("./getDefaultReporter.js");
|
|
19
|
-
var getLogger_js_1 = require("./getLogger.js");
|
|
20
|
-
var store_js_1 = require("./store.js");
|
|
21
|
-
exports.config = function config(options) {
|
|
22
|
-
if (options === void 0) { options = {}; }
|
|
23
|
-
if (store_js_1.store.value.configured) {
|
|
24
|
-
if (store_js_1.store.value.mode === 'production') {
|
|
25
|
-
throw new errors_js_1.ProhibitedDuringProduction('config', { ssf: config });
|
|
26
|
-
}
|
|
27
|
-
if (store_js_1.store.value.mode === 'test' && options.mode !== 'test') {
|
|
28
|
-
var log = (0, getLogger_js_1.getLogger)('standard-log');
|
|
29
|
-
log.warn("already configured for test, ignoring config() call");
|
|
30
|
-
return;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (options.mode)
|
|
34
|
-
store_js_1.store.value.mode = options.mode;
|
|
35
|
-
store_js_1.store.value.logLevel = options.logLevel !== undefined ? options.logLevel : store_js_1.store.value.logLevel;
|
|
36
|
-
if (options.customLevels) {
|
|
37
|
-
var customLevels_1 = options.customLevels;
|
|
38
|
-
(0, type_plus_1.forEachKey)(customLevels_1, function (k) {
|
|
39
|
-
(0, customLogLevel_js_1.addCustomLogLevel)(k, customLevels_1[k]);
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
store_js_1.store.value.reporters = options.reporters || [(0, getDefaultReporter_js_1.getDefaultReporter)()];
|
|
43
|
-
store_js_1.store.value.configured = true;
|
|
44
|
-
if (store_js_1.store.value.mode === 'production') {
|
|
45
|
-
store_js_1.store.freeze(__assign(__assign({}, store_js_1.store.value), { reporters: Object.freeze(store_js_1.store.value.reporters) }));
|
|
46
|
-
}
|
|
47
|
-
else if (store_js_1.store.value.mode === 'development') {
|
|
48
|
-
console.warn("'standard-log' is running in 'development' mode. Configuration is not protected.");
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
Object.defineProperty(exports.config, 'isLocked', {
|
|
52
|
-
/**
|
|
53
|
-
* Gets if the config has already been locked
|
|
54
|
-
*/
|
|
55
|
-
get: function () {
|
|
56
|
-
return store_js_1.store.value.configured;
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
//# sourceMappingURL=config.js.map
|
package/cjs/config.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../ts/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,uCAAsC;AACtC,yDAAuD;AACvD,yCAAwD;AACxD,iEAA4D;AAC5D,+CAA0C;AAC1C,uCAAkC;AAUrB,QAAA,MAAM,GAA6E,SAAS,MAAM,CAAC,OAAoC;IAApC,wBAAA,EAAA,YAAoC;IAClJ,IAAI,gBAAK,CAAC,KAAK,CAAC,UAAU,EAAE;QAC1B,IAAI,gBAAK,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE;YACrC,MAAM,IAAI,sCAA0B,CAAC,QAAQ,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAA;SAChE;QACD,IAAI,gBAAK,CAAC,KAAK,CAAC,IAAI,KAAK,MAAM,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE;YAC1D,IAAM,GAAG,GAAG,IAAA,wBAAS,EAAC,cAAc,CAAC,CAAA;YACrC,GAAG,CAAC,IAAI,CAAC,qDAAqD,CAAC,CAAA;YAC/D,OAAM;SACP;KACF;IAED,IAAI,OAAO,CAAC,IAAI;QAAE,gBAAK,CAAC,KAAK,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAA;IAEjD,gBAAK,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,gBAAK,CAAC,KAAK,CAAC,QAAQ,CAAA;IAE/F,IAAI,OAAO,CAAC,YAAY,EAAE;QACxB,IAAM,cAAY,GAAG,OAAO,CAAC,YAAY,CAAA;QACzC,IAAA,sBAAU,EAAC,cAAY,EAAE,UAAA,CAAC;YACxB,IAAA,qCAAiB,EAAC,CAAC,EAAE,cAAY,CAAC,CAAC,CAAC,CAAC,CAAA;QACvC,CAAC,CAAC,CAAA;KACH;IAED,gBAAK,CAAC,KAAK,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,CAAC,IAAA,0CAAkB,GAAE,CAAC,CAAA;IACnE,gBAAK,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAA;IAE7B,IAAI,gBAAK,CAAC,KAAK,CAAC,IAAI,KAAK,YAAY,EAAE;QACrC,gBAAK,CAAC,MAAM,uBAAM,gBAAK,CAAC,KAAK,KAAE,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,gBAAK,CAAC,KAAK,CAAC,SAAS,CAAC,IAAG,CAAA;KAClF;SACI,IAAI,gBAAK,CAAC,KAAK,CAAC,IAAI,KAAK,aAAa,EAAE;QAC3C,OAAO,CAAC,IAAI,CAAC,kFAAkF,CAAC,CAAA;KACjG;AACH,CAAQ,CAAA;AAER,MAAM,CAAC,cAAc,CAAC,cAAM,EAAE,UAAU,EAAE;IACxC;;OAEG;IACH,GAAG;QACD,OAAO,gBAAK,CAAC,KAAK,CAAC,UAAU,CAAA;IAC/B,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { forEachKey } from 'type-plus'\nimport { addCustomLogLevel } from './customLogLevel.js'\nimport { ProhibitedDuringProduction } from './errors.js'\nimport { getDefaultReporter } from './getDefaultReporter.js'\nimport { getLogger } from './getLogger.js'\nimport { store } from './store.js'\nimport { LogMode, LogReporter } from './types.js'\n\nexport type ConfigOptions = {\n mode: LogMode,\n customLevels: Record<string, number>,\n logLevel: number,\n reporters: LogReporter[]\n}\n\nexport const config: { (options?: Partial<ConfigOptions>): void, readonly isLocked: boolean } = function config(options: Partial<ConfigOptions> = {}) {\n if (store.value.configured) {\n if (store.value.mode === 'production') {\n throw new ProhibitedDuringProduction('config', { ssf: config })\n }\n if (store.value.mode === 'test' && options.mode !== 'test') {\n const log = getLogger('standard-log')\n log.warn(`already configured for test, ignoring config() call`)\n return\n }\n }\n\n if (options.mode) store.value.mode = options.mode\n\n store.value.logLevel = options.logLevel !== undefined ? options.logLevel : store.value.logLevel\n\n if (options.customLevels) {\n const customLevels = options.customLevels\n forEachKey(customLevels, k => {\n addCustomLogLevel(k, customLevels[k])\n })\n }\n\n store.value.reporters = options.reporters || [getDefaultReporter()]\n store.value.configured = true\n\n if (store.value.mode === 'production') {\n store.freeze({ ...store.value, reporters: Object.freeze(store.value.reporters) })\n }\n else if (store.value.mode === 'development') {\n console.warn(`'standard-log' is running in 'development' mode. Configuration is not protected.`)\n }\n} as any\n\nObject.defineProperty(config, 'isLocked', {\n /**\n * Gets if the config has already been locked\n */\n get() {\n return store.value.configured\n }\n})\n"]}
|
package/cjs/config.spec.d.ts
DELETED
package/cjs/config.spec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.spec.d.ts","sourceRoot":"","sources":["../ts/config.spec.ts"],"names":[],"mappings":""}
|
package/cjs/config.spec.js
DELETED
|
@@ -1,72 +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 configForTest_js_1 = require("./configForTest.js");
|
|
9
|
-
var store_js_1 = require("./store.js");
|
|
10
|
-
var testUtil_js_1 = require("./testUtil.js");
|
|
11
|
-
beforeEach(function () { return store_js_1.store.reset(); });
|
|
12
|
-
afterEach(function () { return store_js_1.store.reset(); });
|
|
13
|
-
test('in production mode by default', function () {
|
|
14
|
-
expect(store_js_1.store.value.mode).toBe('production');
|
|
15
|
-
});
|
|
16
|
-
test('default logLevel is info', function () {
|
|
17
|
-
expect(store_js_1.store.value.logLevel).toBe(index_js_1.logLevels.info);
|
|
18
|
-
});
|
|
19
|
-
test('configure default logLevel', function () {
|
|
20
|
-
(0, index_js_1.config)({ logLevel: index_js_1.logLevels.planck });
|
|
21
|
-
expect(store_js_1.store.value.logLevel).toBe(index_js_1.logLevels.planck);
|
|
22
|
-
});
|
|
23
|
-
test('calling config twice throws ProhibitedDuringProduction in production mode', function () {
|
|
24
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
25
|
-
assertron_1.default.throws(function () { return (0, index_js_1.config)({ mode: 'development' }); }, index_js_1.ProhibitedDuringProduction);
|
|
26
|
-
});
|
|
27
|
-
it('throw ProhibitedDuringProduction with ssf to the call site', function () {
|
|
28
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
29
|
-
var err = assertron_1.default.throws(function () { return (0, index_js_1.config)({ mode: 'development' }); }, index_js_1.ProhibitedDuringProduction);
|
|
30
|
-
(0, testUtil_js_1.assertSSF)(err, __filename);
|
|
31
|
-
});
|
|
32
|
-
test('allow calling config with non-test mode while already running in test mode, but emit a warning', function () {
|
|
33
|
-
var reporter = (0, configForTest_js_1.configForTest)().reporter;
|
|
34
|
-
(0, index_js_1.config)({ mode: 'production' });
|
|
35
|
-
expect(reporter.getLogMessageWithLevel()).toEqual('(WARN) already configured for test, ignoring config() call');
|
|
36
|
-
});
|
|
37
|
-
test('allow calling config in test mode again while in test mode. Emit no warning', function () {
|
|
38
|
-
var reporter = (0, configForTest_js_1.configForTest)().reporter;
|
|
39
|
-
(0, index_js_1.config)({ mode: 'test' });
|
|
40
|
-
expect(reporter.getLogMessageWithLevel()).toEqual('');
|
|
41
|
-
});
|
|
42
|
-
test('add custom levels', function () {
|
|
43
|
-
(0, index_js_1.config)({
|
|
44
|
-
customLevels: {
|
|
45
|
-
'urgent': 80
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
expect((0, index_js_1.toLogLevelName)(80)).toBe('urgent');
|
|
49
|
-
});
|
|
50
|
-
test('configure to use a reporter instance', function () {
|
|
51
|
-
(0, index_js_1.config)({
|
|
52
|
-
reporters: [
|
|
53
|
-
(0, index_js_1.createMemoryLogReporter)()
|
|
54
|
-
]
|
|
55
|
-
});
|
|
56
|
-
assertron_1.default.satisfies(store_js_1.store.value.reporters, [{ id: 'memory' }]);
|
|
57
|
-
expect(store_js_1.store.value.reporters.length).toBe(1);
|
|
58
|
-
});
|
|
59
|
-
test('configure as development will emit warning', function () {
|
|
60
|
-
var warn = console.warn;
|
|
61
|
-
var actual;
|
|
62
|
-
console.warn = function (message) { return actual = message; };
|
|
63
|
-
(0, index_js_1.config)({ mode: 'development' });
|
|
64
|
-
expect(actual).toBe("'standard-log' is running in 'development' mode. Configuration is not protected.");
|
|
65
|
-
console.warn = warn;
|
|
66
|
-
});
|
|
67
|
-
test('config.configured', function () {
|
|
68
|
-
expect(index_js_1.config.isLocked).toBeFalsy();
|
|
69
|
-
(0, index_js_1.config)({ mode: 'test' });
|
|
70
|
-
expect(index_js_1.config.isLocked).toBe(true);
|
|
71
|
-
});
|
|
72
|
-
//# sourceMappingURL=config.spec.js.map
|
package/cjs/config.spec.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.spec.js","sourceRoot":"","sources":["../ts/config.spec.ts"],"names":[],"mappings":"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","sourcesContent":["import a from 'assertron'\nimport {\n config, createMemoryLogReporter,\n logLevels, ProhibitedDuringProduction, toLogLevelName\n} from './index.js'\nimport { configForTest } from './configForTest.js'\nimport { store } from './store.js'\nimport { assertSSF } from './testUtil.js'\n\nbeforeEach(() => store.reset())\n\nafterEach(() => store.reset())\n\ntest('in production mode by default', () => {\n expect(store.value.mode).toBe('production')\n})\n\ntest('default logLevel is info', () => {\n expect(store.value.logLevel).toBe(logLevels.info)\n})\n\ntest('configure default logLevel', () => {\n config({ logLevel: logLevels.planck })\n\n expect(store.value.logLevel).toBe(logLevels.planck)\n})\n\ntest('calling config twice throws ProhibitedDuringProduction in production mode', () => {\n config({ mode: 'production' })\n a.throws(() => config({ mode: 'development' }), ProhibitedDuringProduction)\n})\n\nit('throw ProhibitedDuringProduction with ssf to the call site', () => {\n config({ mode: 'production' })\n const err = a.throws(() => config({ mode: 'development' }), ProhibitedDuringProduction)\n\n assertSSF(err, __filename)\n})\n\ntest('allow calling config with non-test mode while already running in test mode, but emit a warning', () => {\n const { reporter } = configForTest()\n config({ mode: 'production' })\n expect(reporter.getLogMessageWithLevel()).toEqual('(WARN) already configured for test, ignoring config() call')\n})\n\ntest('allow calling config in test mode again while in test mode. Emit no warning', () => {\n const { reporter } = configForTest()\n config({ mode: 'test' })\n expect(reporter.getLogMessageWithLevel()).toEqual('')\n})\n\n\ntest('add custom levels', () => {\n config({\n customLevels: {\n 'urgent': 80\n }\n })\n\n expect(toLogLevelName(80)).toBe('urgent')\n})\n\ntest('configure to use a reporter instance', () => {\n config({\n reporters: [\n createMemoryLogReporter()\n ]\n })\n a.satisfies(store.value.reporters, [{ id: 'memory' }])\n expect(store.value.reporters.length).toBe(1)\n})\n\ntest('configure as development will emit warning', () => {\n const warn = console.warn\n let actual: string\n console.warn = message => actual = message\n config({ mode: 'development' })\n\n expect(actual!).toBe(`'standard-log' is running in 'development' mode. Configuration is not protected.`)\n\n console.warn = warn\n})\n\ntest('config.configured', () => {\n expect(config.isLocked).toBeFalsy()\n config({ mode: 'test' })\n expect(config.isLocked).toBe(true)\n})\n"]}
|
package/cjs/configForTest.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configForTest.d.ts","sourceRoot":"","sources":["../ts/configForTest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAGrC,wBAAgB,aAAa,CAAC,QAAQ,CAAC,EAAE,QAAQ;;EAShD"}
|
package/cjs/configForTest.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.configForTest = void 0;
|
|
4
|
-
var config_js_1 = require("./config.js");
|
|
5
|
-
var index_js_1 = require("./memory/index.js");
|
|
6
|
-
var store_js_1 = require("./store.js");
|
|
7
|
-
function configForTest(logLevel) {
|
|
8
|
-
store_js_1.store.reset();
|
|
9
|
-
var reporter = (0, index_js_1.createMemoryLogReporter)();
|
|
10
|
-
(0, config_js_1.config)({
|
|
11
|
-
reporters: [reporter],
|
|
12
|
-
mode: 'test',
|
|
13
|
-
logLevel: logLevel
|
|
14
|
-
});
|
|
15
|
-
return { reporter: reporter };
|
|
16
|
-
}
|
|
17
|
-
exports.configForTest = configForTest;
|
|
18
|
-
//# sourceMappingURL=configForTest.js.map
|
package/cjs/configForTest.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configForTest.js","sourceRoot":"","sources":["../ts/configForTest.ts"],"names":[],"mappings":";;;AAAA,yCAAoC;AACpC,8CAA2D;AAC3D,uCAAkC;AAIlC,SAAgB,aAAa,CAAC,QAAmB;IAC/C,gBAAK,CAAC,KAAK,EAAE,CAAA;IACb,IAAM,QAAQ,GAAG,IAAA,kCAAuB,GAAE,CAAA;IAC1C,IAAA,kBAAM,EAAC;QACL,SAAS,EAAE,CAAC,QAAQ,CAAC;QACrB,IAAI,EAAE,MAAM;QACZ,QAAQ,UAAA;KACT,CAAC,CAAA;IACF,OAAO,EAAE,QAAQ,UAAA,EAAE,CAAA;AACrB,CAAC;AATD,sCASC","sourcesContent":["import { config } from './config.js'\nimport { createMemoryLogReporter } from './memory/index.js'\nimport { store } from './store.js'\nimport { LogLevel } from './types.js'\n\n\nexport function configForTest(logLevel?: LogLevel) {\n store.reset()\n const reporter = createMemoryLogReporter()\n config({\n reporters: [reporter],\n mode: 'test',\n logLevel\n })\n return { reporter }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"configForTest.spec.d.ts","sourceRoot":"","sources":["../ts/configForTest.spec.ts"],"names":[],"mappings":""}
|