standard-log 7.1.0 → 8.0.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/LICENSE +1 -1
- package/{lib → cjs}/LogEntry.d.ts +0 -0
- package/cjs/LogEntry.d.ts.map +1 -0
- package/{lib → cjs}/LogEntry.js +0 -0
- package/cjs/LogEntry.js.map +1 -0
- package/cjs/captureLogs.d.ts +4 -0
- package/cjs/captureLogs.d.ts.map +1 -0
- package/cjs/captureLogs.js +33 -0
- package/cjs/captureLogs.js.map +1 -0
- package/cjs/captureLogs.spec.d.ts +2 -0
- package/cjs/captureLogs.spec.d.ts.map +1 -0
- package/cjs/captureLogs.spec.js +117 -0
- package/cjs/captureLogs.spec.js.map +1 -0
- package/cjs/config.d.ts +12 -0
- package/cjs/config.d.ts.map +1 -0
- package/cjs/config.js +59 -0
- package/cjs/config.js.map +1 -0
- package/cjs/config.spec.d.ts +2 -0
- package/cjs/config.spec.d.ts.map +1 -0
- package/cjs/config.spec.js +66 -0
- package/cjs/config.spec.js.map +1 -0
- package/cjs/configForTest.d.ts +5 -0
- package/cjs/configForTest.d.ts.map +1 -0
- package/cjs/configForTest.js +18 -0
- package/cjs/configForTest.js.map +1 -0
- package/cjs/configForTest.spec.d.ts +2 -0
- package/cjs/configForTest.spec.d.ts.map +1 -0
- package/cjs/configForTest.spec.js +17 -0
- package/cjs/configForTest.spec.js.map +1 -0
- package/cjs/console/createConsoleLogReporter.d.ts +9 -0
- package/cjs/console/createConsoleLogReporter.d.ts.map +1 -0
- package/cjs/console/createConsoleLogReporter.js +42 -0
- package/cjs/console/createConsoleLogReporter.js.map +1 -0
- package/cjs/console/createConsoleLogReporter.spec.d.ts +2 -0
- package/cjs/console/createConsoleLogReporter.spec.d.ts.map +1 -0
- package/cjs/console/createConsoleLogReporter.spec.js +182 -0
- package/cjs/console/createConsoleLogReporter.spec.js.map +1 -0
- package/cjs/console/index.d.ts +4 -0
- package/cjs/console/index.d.ts.map +1 -0
- package/cjs/console/index.js +20 -0
- package/cjs/console/index.js.map +1 -0
- package/{lib → cjs}/console/isConsoleDebugAvailable.d.ts +0 -0
- package/cjs/console/isConsoleDebugAvailable.d.ts.map +1 -0
- package/cjs/console/isConsoleDebugAvailable.js +20 -0
- package/cjs/console/isConsoleDebugAvailable.js.map +1 -0
- package/{lib → cjs}/console/polyfilledConsole.d.ts +0 -0
- package/cjs/console/polyfilledConsole.d.ts.map +1 -0
- package/cjs/console/polyfilledConsole.js +41 -0
- package/cjs/console/polyfilledConsole.js.map +1 -0
- package/{lib → cjs}/console/semverGt.d.ts +0 -0
- package/cjs/console/semverGt.d.ts.map +1 -0
- package/{lib → cjs}/console/semverGt.js +0 -0
- package/cjs/console/semverGt.js.map +1 -0
- package/cjs/console/semverGt.spec.d.ts +2 -0
- package/cjs/console/semverGt.spec.d.ts.map +1 -0
- package/cjs/console/semverGt.spec.js +22 -0
- package/cjs/console/semverGt.spec.js.map +1 -0
- package/{lib → cjs}/console/toConsoleMethod.d.ts +0 -0
- package/cjs/console/toConsoleMethod.d.ts.map +1 -0
- package/cjs/console/toConsoleMethod.js +22 -0
- package/cjs/console/toConsoleMethod.js.map +1 -0
- package/cjs/console/types.d.ts +3 -0
- package/cjs/console/types.d.ts.map +1 -0
- package/{lib → cjs}/console/types.js +0 -0
- package/cjs/console/types.js.map +1 -0
- package/cjs/customLogLevel.d.ts +11 -0
- package/cjs/customLogLevel.d.ts.map +1 -0
- package/cjs/customLogLevel.js +38 -0
- package/cjs/customLogLevel.js.map +1 -0
- package/cjs/customLogLevel.spec.d.ts +2 -0
- package/cjs/customLogLevel.spec.d.ts.map +1 -0
- package/cjs/customLogLevel.spec.js +37 -0
- package/cjs/customLogLevel.spec.js.map +1 -0
- package/{lib → cjs}/errors.d.ts +0 -0
- package/cjs/errors.d.ts.map +1 -0
- package/cjs/errors.js +85 -0
- package/cjs/errors.js.map +1 -0
- package/{lib → cjs}/formatter/createTimestampFormatter.d.ts +0 -0
- package/cjs/formatter/createTimestampFormatter.d.ts.map +1 -0
- package/cjs/formatter/createTimestampFormatter.js +26 -0
- package/cjs/formatter/createTimestampFormatter.js.map +1 -0
- package/cjs/formatter/createTimestampFormatter.spec.d.ts +2 -0
- package/cjs/formatter/createTimestampFormatter.spec.d.ts.map +1 -0
- package/cjs/formatter/createTimestampFormatter.spec.js +23 -0
- package/cjs/formatter/createTimestampFormatter.spec.js.map +1 -0
- package/{lib → cjs}/formatter/formatLogLevel.d.ts +0 -0
- package/cjs/formatter/formatLogLevel.d.ts.map +1 -0
- package/cjs/formatter/formatLogLevel.js +10 -0
- package/cjs/formatter/formatLogLevel.js.map +1 -0
- package/cjs/formatter/index.d.ts +4 -0
- package/cjs/formatter/index.d.ts.map +1 -0
- package/cjs/formatter/index.js +20 -0
- package/cjs/formatter/index.js.map +1 -0
- package/cjs/formatter/plainLogFormatter.d.ts +3 -0
- package/cjs/formatter/plainLogFormatter.d.ts.map +1 -0
- package/cjs/formatter/plainLogFormatter.js +19 -0
- package/cjs/formatter/plainLogFormatter.js.map +1 -0
- package/cjs/formatter/plainLogFormatter.spec.d.ts +2 -0
- package/cjs/formatter/plainLogFormatter.spec.d.ts.map +1 -0
- package/cjs/formatter/plainLogFormatter.spec.js +9 -0
- package/cjs/formatter/plainLogFormatter.spec.js.map +1 -0
- package/{lib → cjs}/getDefaultReporter.browser.d.ts +0 -0
- package/cjs/getDefaultReporter.browser.d.ts.map +1 -0
- package/cjs/getDefaultReporter.browser.js +15 -0
- package/cjs/getDefaultReporter.browser.js.map +1 -0
- package/{lib → cjs}/getDefaultReporter.d.ts +0 -0
- package/cjs/getDefaultReporter.d.ts.map +1 -0
- package/cjs/getDefaultReporter.js +19 -0
- package/cjs/getDefaultReporter.js.map +1 -0
- package/cjs/getLogModeFromEnvironment.browser.d.ts +3 -0
- package/cjs/getLogModeFromEnvironment.browser.d.ts.map +1 -0
- package/{lib → cjs}/getLogModeFromEnvironment.browser.js +0 -0
- package/cjs/getLogModeFromEnvironment.browser.js.map +1 -0
- package/cjs/getLogModeFromEnvironment.d.ts +3 -0
- package/cjs/getLogModeFromEnvironment.d.ts.map +1 -0
- package/cjs/getLogModeFromEnvironment.js +17 -0
- package/cjs/getLogModeFromEnvironment.js.map +1 -0
- package/cjs/getLogModeFromEnvironment.spec.d.ts +2 -0
- package/cjs/getLogModeFromEnvironment.spec.d.ts.map +1 -0
- package/cjs/getLogModeFromEnvironment.spec.js +19 -0
- package/cjs/getLogModeFromEnvironment.spec.js.map +1 -0
- package/cjs/getLogger.d.ts +9 -0
- package/cjs/getLogger.d.ts.map +1 -0
- package/cjs/getLogger.js +103 -0
- package/cjs/getLogger.js.map +1 -0
- package/cjs/getLogger.spec.d.ts +2 -0
- package/cjs/getLogger.spec.d.ts.map +1 -0
- package/cjs/getLogger.spec.js +481 -0
- package/cjs/getLogger.spec.js.map +1 -0
- package/cjs/getLoggers.d.ts +7 -0
- package/cjs/getLoggers.d.ts.map +1 -0
- package/cjs/getLoggers.js +15 -0
- package/cjs/getLoggers.js.map +1 -0
- package/cjs/index.d.ts +17 -0
- package/cjs/index.d.ts.map +1 -0
- package/cjs/index.js +33 -0
- package/cjs/index.js.map +1 -0
- package/{lib → cjs}/logLevel.d.ts +0 -0
- package/cjs/logLevel.d.ts.map +1 -0
- package/{lib → cjs}/logLevel.js +0 -0
- package/cjs/logLevel.js.map +1 -0
- package/cjs/logLevel.spec.d.ts +2 -0
- package/cjs/logLevel.spec.d.ts.map +1 -0
- package/cjs/logLevel.spec.js +195 -0
- package/cjs/logLevel.spec.js.map +1 -0
- package/cjs/logLevelFn.d.ts +20 -0
- package/cjs/logLevelFn.d.ts.map +1 -0
- package/cjs/logLevelFn.js +76 -0
- package/cjs/logLevelFn.js.map +1 -0
- package/cjs/logReporter.d.ts +7 -0
- package/cjs/logReporter.d.ts.map +1 -0
- package/cjs/logReporter.js +29 -0
- package/cjs/logReporter.js.map +1 -0
- package/cjs/logReporter.spec.d.ts +2 -0
- package/cjs/logReporter.spec.d.ts.map +1 -0
- package/cjs/logReporter.spec.js +86 -0
- package/cjs/logReporter.spec.js.map +1 -0
- package/cjs/logReporterInternal.d.ts +3 -0
- package/cjs/logReporterInternal.d.ts.map +1 -0
- package/cjs/logReporterInternal.js +23 -0
- package/cjs/logReporterInternal.js.map +1 -0
- package/cjs/memory/MemoryLogReporter.d.ts +14 -0
- package/cjs/memory/MemoryLogReporter.d.ts.map +1 -0
- package/cjs/memory/MemoryLogReporter.js +56 -0
- package/cjs/memory/MemoryLogReporter.js.map +1 -0
- package/cjs/memory/MemoryLogReporter.spec.d.ts +2 -0
- package/cjs/memory/MemoryLogReporter.spec.d.ts.map +1 -0
- package/cjs/memory/MemoryLogReporter.spec.js +111 -0
- package/cjs/memory/MemoryLogReporter.spec.js.map +1 -0
- package/cjs/memory/index.d.ts +3 -0
- package/cjs/memory/index.d.ts.map +1 -0
- package/cjs/memory/index.js +19 -0
- package/cjs/memory/index.js.map +1 -0
- package/cjs/memory/logEntriesToString.d.ts +3 -0
- package/cjs/memory/logEntriesToString.d.ts.map +1 -0
- package/cjs/memory/logEntriesToString.js +10 -0
- package/cjs/memory/logEntriesToString.js.map +1 -0
- package/cjs/memory/logEntriesToString.spec.d.ts +2 -0
- package/cjs/memory/logEntriesToString.spec.d.ts.map +1 -0
- package/cjs/memory/logEntriesToString.spec.js +36 -0
- package/cjs/memory/logEntriesToString.spec.js.map +1 -0
- package/cjs/memory/toInspectStringForObject.d.ts +3 -0
- package/cjs/memory/toInspectStringForObject.d.ts.map +1 -0
- package/cjs/memory/toInspectStringForObject.js +17 -0
- package/cjs/memory/toInspectStringForObject.js.map +1 -0
- package/cjs/package.json +3 -0
- package/cjs/shouldLog.d.ts +8 -0
- package/cjs/shouldLog.d.ts.map +1 -0
- package/cjs/shouldLog.js +14 -0
- package/cjs/shouldLog.js.map +1 -0
- package/cjs/store.d.ts +3 -0
- package/cjs/store.d.ts.map +1 -0
- package/cjs/store.js +27 -0
- package/cjs/store.js.map +1 -0
- package/cjs/suppressLogs.d.ts +6 -0
- package/cjs/suppressLogs.d.ts.map +1 -0
- package/cjs/suppressLogs.js +17 -0
- package/cjs/suppressLogs.js.map +1 -0
- package/cjs/suppressLogs.spec.d.ts +2 -0
- package/cjs/suppressLogs.spec.d.ts.map +1 -0
- package/cjs/suppressLogs.spec.js +31 -0
- package/cjs/suppressLogs.spec.js.map +1 -0
- package/cjs/testUtil.d.ts +7 -0
- package/cjs/testUtil.d.ts.map +1 -0
- package/cjs/testUtil.js +25 -0
- package/cjs/testUtil.js.map +1 -0
- package/{lib → cjs}/types.d.ts +0 -0
- package/cjs/types.d.ts.map +1 -0
- package/{lib → cjs}/types.js +0 -0
- package/cjs/types.js.map +1 -0
- package/cjs/types.spec.d.ts +2 -0
- package/cjs/types.spec.d.ts.map +1 -0
- package/cjs/types.spec.js +7 -0
- package/cjs/types.spec.js.map +1 -0
- package/cjs/typesInternal.d.ts +20 -0
- package/cjs/typesInternal.d.ts.map +1 -0
- package/{lib → cjs}/typesInternal.js +0 -0
- package/cjs/typesInternal.js.map +1 -0
- package/{lib → cjs}/utils.d.ts +0 -0
- package/cjs/utils.d.ts.map +1 -0
- package/cjs/utils.js +14 -0
- package/cjs/utils.js.map +1 -0
- package/cjs/writeToReporters.d.ts +6 -0
- package/cjs/writeToReporters.d.ts.map +1 -0
- package/cjs/writeToReporters.js +22 -0
- package/cjs/writeToReporters.js.map +1 -0
- package/cjs/writeToReporters.spec.d.ts +2 -0
- package/cjs/writeToReporters.spec.d.ts.map +1 -0
- package/cjs/writeToReporters.spec.js +59 -0
- package/cjs/writeToReporters.spec.js.map +1 -0
- package/dist/standard-log.es5.js +2724 -0
- package/dist/standard-log.es5.js.gz +0 -0
- package/dist/standard-log.es5.js.map +1 -0
- package/dist/standard-log.es5.js.map.gz +0 -0
- package/dist/standard-log.esm.js +2724 -0
- package/dist/standard-log.esm.js.gz +0 -0
- package/dist/standard-log.esm.js.map +1 -0
- package/dist/standard-log.esm.js.map.gz +0 -0
- package/{libm → esm}/LogEntry.d.ts +0 -0
- package/esm/LogEntry.d.ts.map +1 -0
- package/{libm → esm}/LogEntry.js +0 -0
- package/esm/LogEntry.js.map +1 -0
- package/esm/captureLogs.d.ts +4 -0
- package/esm/captureLogs.d.ts.map +1 -0
- package/esm/captureLogs.js +29 -0
- package/esm/captureLogs.js.map +1 -0
- package/esm/captureLogs.spec.d.ts +2 -0
- package/esm/captureLogs.spec.d.ts.map +1 -0
- package/esm/captureLogs.spec.js +45 -0
- package/esm/captureLogs.spec.js.map +1 -0
- package/esm/config.d.ts +12 -0
- package/esm/config.d.ts.map +1 -0
- package/esm/config.js +44 -0
- package/esm/config.js.map +1 -0
- package/esm/config.spec.d.ts +2 -0
- package/esm/config.spec.d.ts.map +1 -0
- package/esm/config.spec.js +61 -0
- package/esm/config.spec.js.map +1 -0
- package/esm/configForTest.d.ts +5 -0
- package/esm/configForTest.d.ts.map +1 -0
- package/esm/configForTest.js +14 -0
- package/esm/configForTest.js.map +1 -0
- package/esm/configForTest.spec.d.ts +2 -0
- package/esm/configForTest.spec.d.ts.map +1 -0
- package/esm/configForTest.spec.js +15 -0
- package/esm/configForTest.spec.js.map +1 -0
- package/esm/console/createConsoleLogReporter.d.ts +9 -0
- package/esm/console/createConsoleLogReporter.d.ts.map +1 -0
- package/esm/console/createConsoleLogReporter.js +37 -0
- package/esm/console/createConsoleLogReporter.js.map +1 -0
- package/esm/console/createConsoleLogReporter.spec.d.ts +2 -0
- package/esm/console/createConsoleLogReporter.spec.d.ts.map +1 -0
- package/esm/console/createConsoleLogReporter.spec.js +153 -0
- package/esm/console/createConsoleLogReporter.spec.js.map +1 -0
- package/esm/console/index.d.ts +4 -0
- package/esm/console/index.d.ts.map +1 -0
- package/esm/console/index.js +4 -0
- package/esm/console/index.js.map +1 -0
- package/{libm → esm}/console/isConsoleDebugAvailable.d.ts +0 -0
- package/esm/console/isConsoleDebugAvailable.d.ts.map +1 -0
- package/esm/console/isConsoleDebugAvailable.js +13 -0
- package/esm/console/isConsoleDebugAvailable.js.map +1 -0
- package/{libm → esm}/console/polyfilledConsole.d.ts +0 -0
- package/esm/console/polyfilledConsole.d.ts.map +1 -0
- package/esm/console/polyfilledConsole.js +32 -0
- package/esm/console/polyfilledConsole.js.map +1 -0
- package/{libm → esm}/console/semverGt.d.ts +0 -0
- package/esm/console/semverGt.d.ts.map +1 -0
- package/{libm → esm}/console/semverGt.js +0 -0
- package/esm/console/semverGt.js.map +1 -0
- package/esm/console/semverGt.spec.d.ts +2 -0
- package/esm/console/semverGt.spec.d.ts.map +1 -0
- package/esm/console/semverGt.spec.js +20 -0
- package/esm/console/semverGt.spec.js.map +1 -0
- package/{libm → esm}/console/toConsoleMethod.d.ts +0 -0
- package/esm/console/toConsoleMethod.d.ts.map +1 -0
- package/esm/console/toConsoleMethod.js +18 -0
- package/esm/console/toConsoleMethod.js.map +1 -0
- package/esm/console/types.d.ts +3 -0
- package/esm/console/types.d.ts.map +1 -0
- package/{libm → esm}/console/types.js +0 -0
- package/esm/console/types.js.map +1 -0
- package/esm/customLogLevel.d.ts +11 -0
- package/esm/customLogLevel.d.ts.map +1 -0
- package/esm/customLogLevel.js +30 -0
- package/esm/customLogLevel.js.map +1 -0
- package/esm/customLogLevel.spec.d.ts +2 -0
- package/esm/customLogLevel.spec.d.ts.map +1 -0
- package/esm/customLogLevel.spec.js +32 -0
- package/esm/customLogLevel.spec.js.map +1 -0
- package/{libm → esm}/errors.d.ts +0 -0
- package/esm/errors.d.ts.map +1 -0
- package/esm/errors.js +52 -0
- package/esm/errors.js.map +1 -0
- package/{libm → esm}/formatter/createTimestampFormatter.d.ts +0 -0
- package/esm/formatter/createTimestampFormatter.d.ts.map +1 -0
- package/{libm → esm}/formatter/createTimestampFormatter.js +0 -0
- package/esm/formatter/createTimestampFormatter.js.map +1 -0
- package/esm/formatter/createTimestampFormatter.spec.d.ts +2 -0
- package/esm/formatter/createTimestampFormatter.spec.d.ts.map +1 -0
- package/esm/formatter/createTimestampFormatter.spec.js +21 -0
- package/esm/formatter/createTimestampFormatter.spec.js.map +1 -0
- package/{libm → esm}/formatter/formatLogLevel.d.ts +0 -0
- package/esm/formatter/formatLogLevel.d.ts.map +1 -0
- package/esm/formatter/formatLogLevel.js +6 -0
- package/esm/formatter/formatLogLevel.js.map +1 -0
- package/esm/formatter/index.d.ts +4 -0
- package/esm/formatter/index.d.ts.map +1 -0
- package/esm/formatter/index.js +4 -0
- package/esm/formatter/index.js.map +1 -0
- package/esm/formatter/plainLogFormatter.d.ts +3 -0
- package/esm/formatter/plainLogFormatter.d.ts.map +1 -0
- package/esm/formatter/plainLogFormatter.js +5 -0
- package/esm/formatter/plainLogFormatter.js.map +1 -0
- package/esm/formatter/plainLogFormatter.spec.d.ts +2 -0
- package/esm/formatter/plainLogFormatter.spec.d.ts.map +1 -0
- package/esm/formatter/plainLogFormatter.spec.js +7 -0
- package/esm/formatter/plainLogFormatter.spec.js.map +1 -0
- package/{libm → esm}/getDefaultReporter.browser.d.ts +0 -0
- package/esm/getDefaultReporter.browser.d.ts.map +1 -0
- package/esm/getDefaultReporter.browser.js +11 -0
- package/esm/getDefaultReporter.browser.js.map +1 -0
- package/{libm → esm}/getDefaultReporter.d.ts +0 -0
- package/esm/getDefaultReporter.d.ts.map +1 -0
- package/esm/getDefaultReporter.js +15 -0
- package/esm/getDefaultReporter.js.map +1 -0
- package/esm/getLogModeFromEnvironment.browser.d.ts +3 -0
- package/esm/getLogModeFromEnvironment.browser.d.ts.map +1 -0
- package/{libm → esm}/getLogModeFromEnvironment.browser.js +0 -0
- package/esm/getLogModeFromEnvironment.browser.js.map +1 -0
- package/esm/getLogModeFromEnvironment.d.ts +3 -0
- package/esm/getLogModeFromEnvironment.d.ts.map +1 -0
- package/esm/getLogModeFromEnvironment.js +13 -0
- package/esm/getLogModeFromEnvironment.js.map +1 -0
- package/esm/getLogModeFromEnvironment.spec.d.ts +2 -0
- package/esm/getLogModeFromEnvironment.spec.d.ts.map +1 -0
- package/esm/getLogModeFromEnvironment.spec.js +14 -0
- package/esm/getLogModeFromEnvironment.spec.js.map +1 -0
- package/esm/getLogger.d.ts +9 -0
- package/esm/getLogger.d.ts.map +1 -0
- package/esm/getLogger.js +78 -0
- package/esm/getLogger.js.map +1 -0
- package/esm/getLogger.spec.d.ts +2 -0
- package/esm/getLogger.spec.d.ts.map +1 -0
- package/esm/getLogger.spec.js +381 -0
- package/esm/getLogger.spec.js.map +1 -0
- package/esm/getLoggers.d.ts +7 -0
- package/esm/getLoggers.d.ts.map +1 -0
- package/esm/getLoggers.js +11 -0
- package/esm/getLoggers.js.map +1 -0
- package/esm/index.d.ts +17 -0
- package/esm/index.d.ts.map +1 -0
- package/esm/index.js +17 -0
- package/esm/index.js.map +1 -0
- package/{libm → esm}/logLevel.d.ts +0 -0
- package/esm/logLevel.d.ts.map +1 -0
- package/{libm → esm}/logLevel.js +0 -0
- package/esm/logLevel.js.map +1 -0
- package/esm/logLevel.spec.d.ts +2 -0
- package/esm/logLevel.spec.d.ts.map +1 -0
- package/esm/logLevel.spec.js +148 -0
- package/esm/logLevel.spec.js.map +1 -0
- package/esm/logLevelFn.d.ts +20 -0
- package/esm/logLevelFn.d.ts.map +1 -0
- package/esm/logLevelFn.js +67 -0
- package/esm/logLevelFn.js.map +1 -0
- package/esm/logReporter.d.ts +7 -0
- package/esm/logReporter.d.ts.map +1 -0
- package/esm/logReporter.js +21 -0
- package/esm/logReporter.js.map +1 -0
- package/esm/logReporter.spec.d.ts +2 -0
- package/esm/logReporter.spec.d.ts.map +1 -0
- package/esm/logReporter.spec.js +81 -0
- package/esm/logReporter.spec.js.map +1 -0
- package/esm/logReporterInternal.d.ts +3 -0
- package/esm/logReporterInternal.d.ts.map +1 -0
- package/esm/logReporterInternal.js +19 -0
- package/esm/logReporterInternal.js.map +1 -0
- package/esm/memory/MemoryLogReporter.d.ts +14 -0
- package/esm/memory/MemoryLogReporter.d.ts.map +1 -0
- package/esm/memory/MemoryLogReporter.js +51 -0
- package/esm/memory/MemoryLogReporter.js.map +1 -0
- package/esm/memory/MemoryLogReporter.spec.d.ts +2 -0
- package/esm/memory/MemoryLogReporter.spec.d.ts.map +1 -0
- package/esm/memory/MemoryLogReporter.spec.js +98 -0
- package/esm/memory/MemoryLogReporter.spec.js.map +1 -0
- package/esm/memory/index.d.ts +3 -0
- package/esm/memory/index.d.ts.map +1 -0
- package/esm/memory/index.js +3 -0
- package/esm/memory/index.js.map +1 -0
- package/esm/memory/logEntriesToString.d.ts +3 -0
- package/esm/memory/logEntriesToString.d.ts.map +1 -0
- package/esm/memory/logEntriesToString.js +6 -0
- package/esm/memory/logEntriesToString.js.map +1 -0
- package/esm/memory/logEntriesToString.spec.d.ts +2 -0
- package/esm/memory/logEntriesToString.spec.d.ts.map +1 -0
- package/esm/memory/logEntriesToString.spec.js +42 -0
- package/esm/memory/logEntriesToString.spec.js.map +1 -0
- package/esm/memory/toInspectStringForObject.d.ts +3 -0
- package/esm/memory/toInspectStringForObject.d.ts.map +1 -0
- package/{libm → esm}/memory/toInspectStringForObject.js +0 -0
- package/esm/memory/toInspectStringForObject.js.map +1 -0
- package/esm/shouldLog.d.ts +8 -0
- package/esm/shouldLog.d.ts.map +1 -0
- package/esm/shouldLog.js +10 -0
- package/esm/shouldLog.js.map +1 -0
- package/esm/store.d.ts +3 -0
- package/esm/store.d.ts.map +1 -0
- package/esm/store.js +24 -0
- package/esm/store.js.map +1 -0
- package/esm/suppressLogs.d.ts +6 -0
- package/esm/suppressLogs.d.ts.map +1 -0
- package/esm/suppressLogs.js +9 -0
- package/esm/suppressLogs.js.map +1 -0
- package/esm/suppressLogs.spec.d.ts +2 -0
- package/esm/suppressLogs.spec.d.ts.map +1 -0
- package/esm/suppressLogs.spec.js +29 -0
- package/esm/suppressLogs.spec.js.map +1 -0
- package/esm/testUtil.d.ts +7 -0
- package/esm/testUtil.d.ts.map +1 -0
- package/esm/testUtil.js +17 -0
- package/esm/testUtil.js.map +1 -0
- package/{libm → esm}/types.d.ts +0 -0
- package/esm/types.d.ts.map +1 -0
- package/{libm → esm}/types.js +0 -0
- package/esm/types.js.map +1 -0
- package/esm/types.spec.d.ts +2 -0
- package/esm/types.spec.d.ts.map +1 -0
- package/esm/types.spec.js +5 -0
- package/esm/types.spec.js.map +1 -0
- package/esm/typesInternal.d.ts +20 -0
- package/esm/typesInternal.d.ts.map +1 -0
- package/{libm → esm}/typesInternal.js +0 -0
- package/esm/typesInternal.js.map +1 -0
- package/{libm → esm}/utils.d.ts +0 -0
- package/esm/utils.d.ts.map +1 -0
- package/esm/utils.js +10 -0
- package/esm/utils.js.map +1 -0
- package/esm/writeToReporters.d.ts +6 -0
- package/esm/writeToReporters.d.ts.map +1 -0
- package/esm/writeToReporters.js +18 -0
- package/esm/writeToReporters.js.map +1 -0
- package/esm/writeToReporters.spec.d.ts +2 -0
- package/esm/writeToReporters.spec.d.ts.map +1 -0
- package/esm/writeToReporters.spec.js +9 -0
- package/esm/writeToReporters.spec.js.map +1 -0
- package/package.json +78 -29
- package/{src → ts}/LogEntry.ts +0 -0
- package/ts/captureLogs.ts +35 -0
- package/ts/config.ts +57 -0
- package/ts/configForTest.ts +16 -0
- package/ts/console/createConsoleLogReporter.ts +42 -0
- package/ts/console/index.ts +3 -0
- package/ts/console/isConsoleDebugAvailable.ts +11 -0
- package/ts/console/polyfilledConsole.ts +34 -0
- package/{src → ts}/console/semverGt.ts +0 -0
- package/ts/console/toConsoleMethod.ts +18 -0
- package/ts/console/types.ts +3 -0
- package/ts/customLogLevel.ts +35 -0
- package/{src → ts}/errors.ts +0 -0
- package/ts/formatter/createTimestampFormatter.ts +21 -0
- package/ts/formatter/formatLogLevel.ts +6 -0
- package/ts/formatter/index.ts +3 -0
- package/ts/formatter/plainLogFormatter.ts +6 -0
- package/ts/getDefaultReporter.browser.ts +13 -0
- package/ts/getDefaultReporter.ts +15 -0
- package/ts/getLogModeFromEnvironment.browser.ts +6 -0
- package/ts/getLogModeFromEnvironment.ts +16 -0
- package/ts/getLogger.ts +92 -0
- package/ts/getLoggers.ts +12 -0
- package/ts/index.ts +16 -0
- package/{src → ts}/logLevel.ts +0 -0
- package/ts/logLevelFn.ts +72 -0
- package/ts/logReporter.ts +26 -0
- package/ts/logReporterInternal.ts +18 -0
- package/ts/memory/MemoryLogReporter.ts +66 -0
- package/ts/memory/index.ts +2 -0
- package/ts/memory/logEntriesToString.ts +7 -0
- package/ts/memory/toInspectStringForObject.ts +13 -0
- package/ts/shouldLog.ts +11 -0
- package/ts/store.ts +25 -0
- package/ts/suppressLogs.ts +14 -0
- package/ts/testUtil.ts +19 -0
- package/{src → ts}/types.ts +0 -0
- package/ts/typesInternal.ts +21 -0
- package/ts/utils.ts +9 -0
- package/ts/writeToReporters.ts +20 -0
- package/dist/standard-log.js +0 -5472
- package/dist/standard-log.js.gz +0 -0
- package/dist/standard-log.js.map +0 -1
- package/dist/standard-log.js.map.gz +0 -0
- package/lib/LogEntry.d.ts.map +0 -1
- package/lib/LogEntry.js.map +0 -1
- package/lib/captureLogs.d.ts +0 -4
- package/lib/captureLogs.d.ts.map +0 -1
- package/lib/captureLogs.js +0 -33
- package/lib/captureLogs.js.map +0 -1
- package/lib/config.d.ts +0 -12
- package/lib/config.d.ts.map +0 -1
- package/lib/config.js +0 -49
- package/lib/config.js.map +0 -1
- package/lib/configForTest.d.ts +0 -5
- package/lib/configForTest.d.ts.map +0 -1
- package/lib/configForTest.js +0 -18
- package/lib/configForTest.js.map +0 -1
- package/lib/console/createConsoleLogReporter.d.ts +0 -9
- package/lib/console/createConsoleLogReporter.d.ts.map +0 -1
- package/lib/console/createConsoleLogReporter.js +0 -42
- package/lib/console/createConsoleLogReporter.js.map +0 -1
- package/lib/console/index.d.ts +0 -4
- package/lib/console/index.d.ts.map +0 -1
- package/lib/console/index.js +0 -7
- package/lib/console/index.js.map +0 -1
- package/lib/console/isConsoleDebugAvailable.d.ts.map +0 -1
- package/lib/console/isConsoleDebugAvailable.js +0 -18
- package/lib/console/isConsoleDebugAvailable.js.map +0 -1
- package/lib/console/polyfilledConsole.d.ts.map +0 -1
- package/lib/console/polyfilledConsole.js +0 -41
- package/lib/console/polyfilledConsole.js.map +0 -1
- package/lib/console/semverGt.d.ts.map +0 -1
- package/lib/console/semverGt.js.map +0 -1
- package/lib/console/toConsoleMethod.d.ts.map +0 -1
- package/lib/console/toConsoleMethod.js +0 -22
- package/lib/console/toConsoleMethod.js.map +0 -1
- package/lib/console/types.d.ts +0 -3
- package/lib/console/types.d.ts.map +0 -1
- package/lib/console/types.js.map +0 -1
- package/lib/customLogLevel.d.ts +0 -11
- package/lib/customLogLevel.d.ts.map +0 -1
- package/lib/customLogLevel.js +0 -38
- package/lib/customLogLevel.js.map +0 -1
- package/lib/errors.d.ts.map +0 -1
- package/lib/errors.js +0 -46
- package/lib/errors.js.map +0 -1
- package/lib/formatter/createTimestampFormatter.d.ts.map +0 -1
- package/lib/formatter/createTimestampFormatter.js +0 -24
- package/lib/formatter/createTimestampFormatter.js.map +0 -1
- package/lib/formatter/formatLogLevel.d.ts.map +0 -1
- package/lib/formatter/formatLogLevel.js +0 -10
- package/lib/formatter/formatLogLevel.js.map +0 -1
- package/lib/formatter/index.d.ts +0 -4
- package/lib/formatter/index.d.ts.map +0 -1
- package/lib/formatter/index.js +0 -7
- package/lib/formatter/index.js.map +0 -1
- package/lib/formatter/plainLogFormatter.d.ts +0 -3
- package/lib/formatter/plainLogFormatter.d.ts.map +0 -1
- package/lib/formatter/plainLogFormatter.js +0 -11
- package/lib/formatter/plainLogFormatter.js.map +0 -1
- package/lib/getDefaultReporter.browser.d.ts.map +0 -1
- package/lib/getDefaultReporter.browser.js +0 -15
- package/lib/getDefaultReporter.browser.js.map +0 -1
- package/lib/getDefaultReporter.d.ts.map +0 -1
- package/lib/getDefaultReporter.js +0 -19
- package/lib/getDefaultReporter.js.map +0 -1
- package/lib/getLogModeFromEnvironment.browser.d.ts +0 -3
- package/lib/getLogModeFromEnvironment.browser.d.ts.map +0 -1
- package/lib/getLogModeFromEnvironment.browser.js.map +0 -1
- package/lib/getLogModeFromEnvironment.d.ts +0 -3
- package/lib/getLogModeFromEnvironment.d.ts.map +0 -1
- package/lib/getLogModeFromEnvironment.js +0 -17
- package/lib/getLogModeFromEnvironment.js.map +0 -1
- package/lib/getLogger.d.ts +0 -9
- package/lib/getLogger.d.ts.map +0 -1
- package/lib/getLogger.js +0 -95
- package/lib/getLogger.js.map +0 -1
- package/lib/getLoggers.d.ts +0 -7
- package/lib/getLoggers.d.ts.map +0 -1
- package/lib/getLoggers.js +0 -15
- package/lib/getLoggers.js.map +0 -1
- package/lib/index.d.ts +0 -17
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -20
- package/lib/index.js.map +0 -1
- package/lib/logLevel.d.ts.map +0 -1
- package/lib/logLevel.js.map +0 -1
- package/lib/logLevelFn.d.ts +0 -20
- package/lib/logLevelFn.d.ts.map +0 -1
- package/lib/logLevelFn.js +0 -76
- package/lib/logLevelFn.js.map +0 -1
- package/lib/logReporter.d.ts +0 -7
- package/lib/logReporter.d.ts.map +0 -1
- package/lib/logReporter.js +0 -29
- package/lib/logReporter.js.map +0 -1
- package/lib/logReporterInternal.d.ts +0 -3
- package/lib/logReporterInternal.d.ts.map +0 -1
- package/lib/logReporterInternal.js +0 -23
- package/lib/logReporterInternal.js.map +0 -1
- package/lib/memory/MemoryLogReporter.d.ts +0 -14
- package/lib/memory/MemoryLogReporter.d.ts.map +0 -1
- package/lib/memory/MemoryLogReporter.js +0 -56
- package/lib/memory/MemoryLogReporter.js.map +0 -1
- package/lib/memory/index.d.ts +0 -3
- package/lib/memory/index.d.ts.map +0 -1
- package/lib/memory/index.js +0 -6
- package/lib/memory/index.js.map +0 -1
- package/lib/memory/logEntriesToString.d.ts +0 -3
- package/lib/memory/logEntriesToString.d.ts.map +0 -1
- package/lib/memory/logEntriesToString.js +0 -10
- package/lib/memory/logEntriesToString.js.map +0 -1
- package/lib/memory/toInspectStringForObject.d.ts +0 -3
- package/lib/memory/toInspectStringForObject.d.ts.map +0 -1
- package/lib/memory/toInspectStringForObject.js +0 -15
- package/lib/memory/toInspectStringForObject.js.map +0 -1
- package/lib/shouldLog.d.ts +0 -8
- package/lib/shouldLog.d.ts.map +0 -1
- package/lib/shouldLog.js +0 -14
- package/lib/shouldLog.js.map +0 -1
- package/lib/store.d.ts +0 -3
- package/lib/store.d.ts.map +0 -1
- package/lib/store.js +0 -17
- package/lib/store.js.map +0 -1
- package/lib/suppressLogs.d.ts +0 -6
- package/lib/suppressLogs.d.ts.map +0 -1
- package/lib/suppressLogs.js +0 -17
- package/lib/suppressLogs.js.map +0 -1
- package/lib/testUtil.d.ts +0 -7
- package/lib/testUtil.d.ts.map +0 -1
- package/lib/testUtil.js +0 -23
- package/lib/testUtil.js.map +0 -1
- package/lib/types.d.ts.map +0 -1
- package/lib/types.js.map +0 -1
- package/lib/typesInternal.d.ts +0 -20
- package/lib/typesInternal.d.ts.map +0 -1
- package/lib/typesInternal.js.map +0 -1
- package/lib/utils.d.ts.map +0 -1
- package/lib/utils.js +0 -14
- package/lib/utils.js.map +0 -1
- package/lib/writeToReporters.d.ts +0 -6
- package/lib/writeToReporters.d.ts.map +0 -1
- package/lib/writeToReporters.js +0 -22
- package/lib/writeToReporters.js.map +0 -1
- package/libm/LogEntry.d.ts.map +0 -1
- package/libm/LogEntry.js.map +0 -1
- package/libm/captureLogs.d.ts +0 -4
- package/libm/captureLogs.d.ts.map +0 -1
- package/libm/captureLogs.js +0 -29
- package/libm/captureLogs.js.map +0 -1
- package/libm/config.d.ts +0 -12
- package/libm/config.d.ts.map +0 -1
- package/libm/config.js +0 -44
- package/libm/config.js.map +0 -1
- package/libm/configForTest.d.ts +0 -5
- package/libm/configForTest.d.ts.map +0 -1
- package/libm/configForTest.js +0 -14
- package/libm/configForTest.js.map +0 -1
- package/libm/console/createConsoleLogReporter.d.ts +0 -9
- package/libm/console/createConsoleLogReporter.d.ts.map +0 -1
- package/libm/console/createConsoleLogReporter.js +0 -37
- package/libm/console/createConsoleLogReporter.js.map +0 -1
- package/libm/console/index.d.ts +0 -4
- package/libm/console/index.d.ts.map +0 -1
- package/libm/console/index.js +0 -4
- package/libm/console/index.js.map +0 -1
- package/libm/console/isConsoleDebugAvailable.d.ts.map +0 -1
- package/libm/console/isConsoleDebugAvailable.js +0 -13
- package/libm/console/isConsoleDebugAvailable.js.map +0 -1
- package/libm/console/polyfilledConsole.d.ts.map +0 -1
- package/libm/console/polyfilledConsole.js +0 -32
- package/libm/console/polyfilledConsole.js.map +0 -1
- package/libm/console/semverGt.d.ts.map +0 -1
- package/libm/console/semverGt.js.map +0 -1
- package/libm/console/toConsoleMethod.d.ts.map +0 -1
- package/libm/console/toConsoleMethod.js +0 -18
- package/libm/console/toConsoleMethod.js.map +0 -1
- package/libm/console/types.d.ts +0 -3
- package/libm/console/types.d.ts.map +0 -1
- package/libm/console/types.js.map +0 -1
- package/libm/customLogLevel.d.ts +0 -11
- package/libm/customLogLevel.d.ts.map +0 -1
- package/libm/customLogLevel.js +0 -30
- package/libm/customLogLevel.js.map +0 -1
- package/libm/errors.d.ts.map +0 -1
- package/libm/errors.js +0 -32
- package/libm/errors.js.map +0 -1
- package/libm/formatter/createTimestampFormatter.d.ts.map +0 -1
- package/libm/formatter/createTimestampFormatter.js.map +0 -1
- package/libm/formatter/formatLogLevel.d.ts.map +0 -1
- package/libm/formatter/formatLogLevel.js +0 -6
- package/libm/formatter/formatLogLevel.js.map +0 -1
- package/libm/formatter/index.d.ts +0 -4
- package/libm/formatter/index.d.ts.map +0 -1
- package/libm/formatter/index.js +0 -4
- package/libm/formatter/index.js.map +0 -1
- package/libm/formatter/plainLogFormatter.d.ts +0 -3
- package/libm/formatter/plainLogFormatter.d.ts.map +0 -1
- package/libm/formatter/plainLogFormatter.js +0 -5
- package/libm/formatter/plainLogFormatter.js.map +0 -1
- package/libm/getDefaultReporter.browser.d.ts.map +0 -1
- package/libm/getDefaultReporter.browser.js +0 -11
- package/libm/getDefaultReporter.browser.js.map +0 -1
- package/libm/getDefaultReporter.d.ts.map +0 -1
- package/libm/getDefaultReporter.js +0 -15
- package/libm/getDefaultReporter.js.map +0 -1
- package/libm/getLogModeFromEnvironment.browser.d.ts +0 -3
- package/libm/getLogModeFromEnvironment.browser.d.ts.map +0 -1
- package/libm/getLogModeFromEnvironment.browser.js.map +0 -1
- package/libm/getLogModeFromEnvironment.d.ts +0 -3
- package/libm/getLogModeFromEnvironment.d.ts.map +0 -1
- package/libm/getLogModeFromEnvironment.js +0 -13
- package/libm/getLogModeFromEnvironment.js.map +0 -1
- package/libm/getLogger.d.ts +0 -9
- package/libm/getLogger.d.ts.map +0 -1
- package/libm/getLogger.js +0 -78
- package/libm/getLogger.js.map +0 -1
- package/libm/getLoggers.d.ts +0 -7
- package/libm/getLoggers.d.ts.map +0 -1
- package/libm/getLoggers.js +0 -11
- package/libm/getLoggers.js.map +0 -1
- package/libm/index.d.ts +0 -17
- package/libm/index.d.ts.map +0 -1
- package/libm/index.js +0 -17
- package/libm/index.js.map +0 -1
- package/libm/logLevel.d.ts.map +0 -1
- package/libm/logLevel.js.map +0 -1
- package/libm/logLevelFn.d.ts +0 -20
- package/libm/logLevelFn.d.ts.map +0 -1
- package/libm/logLevelFn.js +0 -67
- package/libm/logLevelFn.js.map +0 -1
- package/libm/logReporter.d.ts +0 -7
- package/libm/logReporter.d.ts.map +0 -1
- package/libm/logReporter.js +0 -21
- package/libm/logReporter.js.map +0 -1
- package/libm/logReporterInternal.d.ts +0 -3
- package/libm/logReporterInternal.d.ts.map +0 -1
- package/libm/logReporterInternal.js +0 -19
- package/libm/logReporterInternal.js.map +0 -1
- package/libm/memory/MemoryLogReporter.d.ts +0 -14
- package/libm/memory/MemoryLogReporter.d.ts.map +0 -1
- package/libm/memory/MemoryLogReporter.js +0 -51
- package/libm/memory/MemoryLogReporter.js.map +0 -1
- package/libm/memory/index.d.ts +0 -3
- package/libm/memory/index.d.ts.map +0 -1
- package/libm/memory/index.js +0 -3
- package/libm/memory/index.js.map +0 -1
- package/libm/memory/logEntriesToString.d.ts +0 -3
- package/libm/memory/logEntriesToString.d.ts.map +0 -1
- package/libm/memory/logEntriesToString.js +0 -6
- package/libm/memory/logEntriesToString.js.map +0 -1
- package/libm/memory/toInspectStringForObject.d.ts +0 -3
- package/libm/memory/toInspectStringForObject.d.ts.map +0 -1
- package/libm/memory/toInspectStringForObject.js.map +0 -1
- package/libm/shouldLog.d.ts +0 -8
- package/libm/shouldLog.d.ts.map +0 -1
- package/libm/shouldLog.js +0 -10
- package/libm/shouldLog.js.map +0 -1
- package/libm/store.d.ts +0 -3
- package/libm/store.d.ts.map +0 -1
- package/libm/store.js +0 -24
- package/libm/store.js.map +0 -1
- package/libm/suppressLogs.d.ts +0 -6
- package/libm/suppressLogs.d.ts.map +0 -1
- package/libm/suppressLogs.js +0 -9
- package/libm/suppressLogs.js.map +0 -1
- package/libm/testUtil.d.ts +0 -7
- package/libm/testUtil.d.ts.map +0 -1
- package/libm/testUtil.js +0 -17
- package/libm/testUtil.js.map +0 -1
- package/libm/types.d.ts.map +0 -1
- package/libm/types.js.map +0 -1
- package/libm/typesInternal.d.ts +0 -20
- package/libm/typesInternal.d.ts.map +0 -1
- package/libm/typesInternal.js.map +0 -1
- package/libm/utils.d.ts.map +0 -1
- package/libm/utils.js +0 -10
- package/libm/utils.js.map +0 -1
- package/libm/writeToReporters.d.ts +0 -6
- package/libm/writeToReporters.d.ts.map +0 -1
- package/libm/writeToReporters.js +0 -18
- package/libm/writeToReporters.js.map +0 -1
- package/src/captureLogs.spec.ts +0 -52
- package/src/captureLogs.ts +0 -35
- package/src/config.spec.ts +0 -80
- package/src/config.ts +0 -57
- package/src/configForTest.spec.ts +0 -16
- package/src/configForTest.ts +0 -16
- package/src/console/createConsoleLogReporter.spec.ts +0 -198
- package/src/console/createConsoleLogReporter.ts +0 -42
- package/src/console/index.ts +0 -3
- package/src/console/isConsoleDebugAvailable.ts +0 -11
- package/src/console/polyfilledConsole.ts +0 -34
- package/src/console/semverGt.spec.ts +0 -25
- package/src/console/toConsoleMethod.ts +0 -18
- package/src/console/types.ts +0 -3
- package/src/customLogLevel.spec.ts +0 -39
- package/src/customLogLevel.ts +0 -35
- package/src/formatter/createTimestampFormatter.spec.ts +0 -24
- package/src/formatter/createTimestampFormatter.ts +0 -21
- package/src/formatter/formatLogLevel.ts +0 -6
- package/src/formatter/index.ts +0 -3
- package/src/formatter/plainLogFormatter.spec.ts +0 -8
- package/src/formatter/plainLogFormatter.ts +0 -6
- package/src/getDefaultReporter.browser.ts +0 -13
- package/src/getDefaultReporter.ts +0 -15
- package/src/getLogModeFromEnvironment.browser.ts +0 -6
- package/src/getLogModeFromEnvironment.spec.ts +0 -16
- package/src/getLogModeFromEnvironment.ts +0 -16
- package/src/getLogger.spec.ts +0 -460
- package/src/getLogger.ts +0 -92
- package/src/getLoggers.ts +0 -12
- package/src/index.ts +0 -16
- package/src/logLevel.spec.ts +0 -161
- package/src/logLevelFn.ts +0 -72
- package/src/logReporter.spec.ts +0 -99
- package/src/logReporter.ts +0 -26
- package/src/logReporterInternal.ts +0 -18
- package/src/memory/MemoryLogReporter.spec.ts +0 -114
- package/src/memory/MemoryLogReporter.ts +0 -66
- package/src/memory/index.ts +0 -2
- package/src/memory/logEntriesToString.spec.ts +0 -47
- package/src/memory/logEntriesToString.ts +0 -7
- package/src/memory/toInspectStringForObject.ts +0 -13
- package/src/shouldLog.ts +0 -11
- package/src/store.ts +0 -25
- package/src/suppressLogs.spec.ts +0 -34
- package/src/suppressLogs.ts +0 -14
- package/src/testUtil.ts +0 -19
- package/src/types.spec.ts +0 -7
- package/src/typesInternal.ts +0 -21
- package/src/utils.ts +0 -9
- package/src/writeToReporters.spec.ts +0 -9
- package/src/writeToReporters.ts +0 -20
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { required } from 'type-plus';
|
|
2
|
+
import { plainLogFormatter } from '../formatter/index.js';
|
|
3
|
+
import { assertLogModeIsNotProduction } from '../utils.js';
|
|
4
|
+
import { polyfilledConsole } from './polyfilledConsole.js';
|
|
5
|
+
import { toConsoleMethod } from './toConsoleMethod.js';
|
|
6
|
+
export function createConsoleLogReporter(options) {
|
|
7
|
+
const opts = required({ id: 'console', formatter: plainLogFormatter }, options);
|
|
8
|
+
const { id } = opts;
|
|
9
|
+
let { formatter, filter } = opts;
|
|
10
|
+
return {
|
|
11
|
+
id,
|
|
12
|
+
isConsoleReporter: true,
|
|
13
|
+
get formatter() {
|
|
14
|
+
return formatter;
|
|
15
|
+
},
|
|
16
|
+
set formatter(value) {
|
|
17
|
+
assertLogModeIsNotProduction('set Reporter.formatter');
|
|
18
|
+
formatter = value;
|
|
19
|
+
},
|
|
20
|
+
get filter() {
|
|
21
|
+
return filter;
|
|
22
|
+
},
|
|
23
|
+
set filter(value) {
|
|
24
|
+
assertLogModeIsNotProduction('set Reporter.filter');
|
|
25
|
+
filter = value;
|
|
26
|
+
},
|
|
27
|
+
console: polyfilledConsole,
|
|
28
|
+
write(entry) {
|
|
29
|
+
if (filter && !filter(entry))
|
|
30
|
+
return;
|
|
31
|
+
const values = formatter(entry);
|
|
32
|
+
const method = toConsoleMethod(entry.level);
|
|
33
|
+
this.console[method](...values);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=createConsoleLogReporter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConsoleLogReporter.js","sourceRoot":"","sources":["../../ts/console/createConsoleLogReporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAA;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAOtD,MAAM,UAAU,wBAAwB,CAAC,OAAmC;IAC1E,MAAM,IAAI,GAAG,QAAQ,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,iBAAiB,EAAE,EAAE,OAAO,CAAC,CAAA;IAC/E,MAAM,EAAE,EAAE,EAAE,GAAG,IAAI,CAAA;IACnB,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,IAAI,CAAA;IAChC,OAAO;QACL,EAAE;QACF,iBAAiB,EAAE,IAAI;QACvB,IAAI,SAAS;YACX,OAAO,SAAS,CAAA;QAClB,CAAC;QACD,IAAI,SAAS,CAAC,KAA0B;YACtC,4BAA4B,CAAC,wBAAwB,CAAC,CAAA;YACtD,SAAS,GAAG,KAAK,CAAA;QACnB,CAAC;QACD,IAAI,MAAM;YACR,OAAO,MAAM,CAAA;QACf,CAAC;QACD,IAAI,MAAM,CAAC,KAAgB;YACzB,4BAA4B,CAAC,qBAAqB,CAAC,CAAA;YACnD,MAAM,GAAG,KAAK,CAAA;QAChB,CAAC;QACD,OAAO,EAAE,iBAAiB;QAC1B,KAAK,CAAC,KAAK;YACT,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;gBAAE,OAAM;YACpC,MAAM,MAAM,GAAG,SAAS,CAAC,KAAK,CAAC,CAAA;YAC/B,MAAM,MAAM,GAAG,eAAe,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;YAC3C,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC,CAAA;QACjC,CAAC;KACF,CAAA;AACH,CAAC","sourcesContent":["import { required } from 'type-plus'\nimport { plainLogFormatter } from '../formatter/index.js'\nimport { LogFormatter, LogReporter, LogReporterOptions, LogFilter } from '../types.js'\nimport { assertLogModeIsNotProduction } from '../utils.js'\nimport { polyfilledConsole } from './polyfilledConsole.js'\nimport { toConsoleMethod } from './toConsoleMethod.js'\nimport { Console } from './types.js'\n\nexport type ConsoleLogReporter = LogReporter<any[]> & { console: Console }\nexport type ConsoleLogFormatter = LogFormatter<any[]>\nexport type ConsoleLogReporterOptions = LogReporterOptions<any[]>\n\nexport function createConsoleLogReporter(options?: ConsoleLogReporterOptions): ConsoleLogReporter {\n const opts = required({ id: 'console', formatter: plainLogFormatter }, options)\n const { id } = opts\n let { formatter, filter } = opts\n return {\n id,\n isConsoleReporter: true,\n get formatter() {\n return formatter\n },\n set formatter(value: ConsoleLogFormatter) {\n assertLogModeIsNotProduction('set Reporter.formatter')\n formatter = value\n },\n get filter() {\n return filter\n },\n set filter(value: LogFilter) {\n assertLogModeIsNotProduction('set Reporter.filter')\n filter = value\n },\n console: polyfilledConsole,\n write(entry) {\n if (filter && !filter(entry)) return\n const values = formatter(entry)\n const method = toConsoleMethod(entry.level)\n this.console[method](...values)\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConsoleLogReporter.spec.d.ts","sourceRoot":"","sources":["../../ts/console/createConsoleLogReporter.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import a from 'assertron';
|
|
2
|
+
import { addCustomLogLevel, clearCustomLogLevel, config, configForTest, createConsoleLogReporter, logLevels, plainLogFormatter, ProhibitedDuringProduction } from '../index.js';
|
|
3
|
+
import { store } from '../store.js';
|
|
4
|
+
describe('production checks', () => {
|
|
5
|
+
beforeEach(() => store.reset());
|
|
6
|
+
test('set filter during production mode throws', () => {
|
|
7
|
+
config({ mode: 'production' });
|
|
8
|
+
const reporter = createConsoleLogReporter();
|
|
9
|
+
a.throws(() => { reporter.filter = () => true; }, ProhibitedDuringProduction);
|
|
10
|
+
});
|
|
11
|
+
const idFormatter = (entry) => [entry.id];
|
|
12
|
+
test('set formatter during production mode throws', () => {
|
|
13
|
+
config({ mode: 'production' });
|
|
14
|
+
const reporter = createConsoleLogReporter();
|
|
15
|
+
a.throws(() => reporter.formatter = idFormatter, ProhibitedDuringProduction);
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
describe('unit tests', () => {
|
|
19
|
+
beforeEach(() => configForTest());
|
|
20
|
+
describe('rendering tests', () => {
|
|
21
|
+
test('plain rendering', () => {
|
|
22
|
+
const reporter = createConsoleLogReporter({ formatter: plainLogFormatter });
|
|
23
|
+
['emergency', 'info', 'warn', 'debug'].forEach(level => {
|
|
24
|
+
reporter.write({ id: 'plain', level: logLevels[level], args: ['hello', 'world'], timestamp: new Date() });
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('id', () => {
|
|
29
|
+
test('default is "console"', () => {
|
|
30
|
+
const reporter = createConsoleLogReporter();
|
|
31
|
+
expect(reporter.id).toBe('console');
|
|
32
|
+
});
|
|
33
|
+
test('can be overridden', () => {
|
|
34
|
+
const reporter = createConsoleLogReporter({ id: 'neo-console' });
|
|
35
|
+
expect(reporter.id).toBe('neo-console');
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
describe('log level', () => {
|
|
39
|
+
test('error, alert, critical and emergency logs are written to console.error', () => {
|
|
40
|
+
const id = 'log';
|
|
41
|
+
const reporter = createConsoleLogReporter();
|
|
42
|
+
const fakeConsole = reporter.console = createFakeConsole();
|
|
43
|
+
reporter.write({ id, level: logLevels.emergency, args: ['emergency'], timestamp: new Date() });
|
|
44
|
+
reporter.write({ id, level: logLevels.critical, args: ['critical'], timestamp: new Date() });
|
|
45
|
+
reporter.write({ id, level: logLevels.alert, args: ['alert'], timestamp: new Date() });
|
|
46
|
+
reporter.write({ id, level: logLevels.error, args: ['error'], timestamp: new Date() });
|
|
47
|
+
expect(fakeConsole.errors.length).toBe(4);
|
|
48
|
+
});
|
|
49
|
+
test('warn logs are written to console.warn', () => {
|
|
50
|
+
const id = 'log';
|
|
51
|
+
const reporter = createConsoleLogReporter();
|
|
52
|
+
const fakeConsole = reporter.console = createFakeConsole();
|
|
53
|
+
reporter.write({ id, level: logLevels.warn, args: ['warn'], timestamp: new Date() });
|
|
54
|
+
expect(fakeConsole.warns.length).toBe(1);
|
|
55
|
+
});
|
|
56
|
+
test('notice and info logs are written to console.info', () => {
|
|
57
|
+
const id = 'log';
|
|
58
|
+
const reporter = createConsoleLogReporter();
|
|
59
|
+
const fakeConsole = reporter.console = createFakeConsole();
|
|
60
|
+
reporter.write({ id, level: logLevels.notice, args: ['notice'], timestamp: new Date() });
|
|
61
|
+
reporter.write({ id, level: logLevels.info, args: ['info'], timestamp: new Date() });
|
|
62
|
+
expect(fakeConsole.infos.length).toBe(2);
|
|
63
|
+
});
|
|
64
|
+
test('debug, trace, and planck logs are written to console.debug', () => {
|
|
65
|
+
const id = 'log';
|
|
66
|
+
const reporter = createConsoleLogReporter();
|
|
67
|
+
const fakeConsole = reporter.console = createFakeConsole();
|
|
68
|
+
reporter.write({ id, level: logLevels.debug, args: ['debug'], timestamp: new Date() });
|
|
69
|
+
reporter.write({ id, level: logLevels.trace, args: ['trace'], timestamp: new Date() });
|
|
70
|
+
reporter.write({ id, level: logLevels.planck, args: ['planck'], timestamp: new Date() });
|
|
71
|
+
expect(fakeConsole.debugs.length).toBe(3);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
describe('custom logs', () => {
|
|
75
|
+
afterEach(() => clearCustomLogLevel());
|
|
76
|
+
test('are written according to their log level value', () => {
|
|
77
|
+
addCustomLogLevel('high', 50);
|
|
78
|
+
addCustomLogLevel('important', 450);
|
|
79
|
+
addCustomLogLevel('interest', 650);
|
|
80
|
+
addCustomLogLevel('silly', 1000);
|
|
81
|
+
const id = 'log';
|
|
82
|
+
const reporter = createConsoleLogReporter();
|
|
83
|
+
const fakeConsole = reporter.console = createFakeConsole();
|
|
84
|
+
reporter.write({ id, level: 50, args: ['a'], timestamp: new Date() });
|
|
85
|
+
reporter.write({ id, level: 450, args: ['b'], timestamp: new Date() });
|
|
86
|
+
reporter.write({ id, level: 650, args: ['c'], timestamp: new Date() });
|
|
87
|
+
reporter.write({ id, level: 1000, args: ['d'], timestamp: new Date() });
|
|
88
|
+
expect(fakeConsole.errors.length).toBe(1);
|
|
89
|
+
expect(fakeConsole.warns.length).toBe(1);
|
|
90
|
+
expect(fakeConsole.infos.length).toBe(1);
|
|
91
|
+
expect(fakeConsole.debugs.length).toBe(1);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
const idFormatter = (entry) => [entry.id];
|
|
95
|
+
describe('formatter', () => {
|
|
96
|
+
test('use specific formatter', () => {
|
|
97
|
+
const id = 'id-only';
|
|
98
|
+
const reporter = createConsoleLogReporter({ formatter: idFormatter });
|
|
99
|
+
const fakeConsole = reporter.console = createFakeConsole();
|
|
100
|
+
reporter.write({ id, level: logLevels.emergency, args: ['emergency'], timestamp: new Date() });
|
|
101
|
+
expect(fakeConsole.errors).toEqual([['id-only']]);
|
|
102
|
+
});
|
|
103
|
+
test('formatter can be changed afterward', () => {
|
|
104
|
+
const reporter = createConsoleLogReporter();
|
|
105
|
+
const formatter = reporter.formatter;
|
|
106
|
+
reporter.formatter = idFormatter;
|
|
107
|
+
expect(reporter.formatter).not.toEqual(formatter);
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
describe('filter', () => {
|
|
111
|
+
const filter = (entry) => entry.id !== 'secret';
|
|
112
|
+
test('use specific filter', () => {
|
|
113
|
+
const reporter = createConsoleLogReporter({ formatter: idFormatter, filter });
|
|
114
|
+
const fakeConsole = reporter.console = createFakeConsole();
|
|
115
|
+
reporter.write({ id: 'normal', level: logLevels.emergency, args: ['emergency'], timestamp: new Date() });
|
|
116
|
+
reporter.write({ id: 'secret', level: logLevels.emergency, args: ['emergency'], timestamp: new Date() });
|
|
117
|
+
expect(fakeConsole.errors).toEqual([['normal']]);
|
|
118
|
+
});
|
|
119
|
+
test('can change filter', () => {
|
|
120
|
+
const reporter = createConsoleLogReporter();
|
|
121
|
+
const filter = reporter.filter;
|
|
122
|
+
reporter.filter = entry => entry.id !== 'secret';
|
|
123
|
+
expect(reporter.filter).not.toEqual(filter);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
test('write log entry with multiple arguments', () => {
|
|
127
|
+
const id = 'log';
|
|
128
|
+
const reporter = createConsoleLogReporter({ formatter: plainLogFormatter });
|
|
129
|
+
const fakeConsole = reporter.console = createFakeConsole();
|
|
130
|
+
const entry = { id, level: logLevels.info, args: ['a', 'b', 'c'], timestamp: new Date() };
|
|
131
|
+
reporter.write(entry);
|
|
132
|
+
expect(fakeConsole.infos).toEqual([
|
|
133
|
+
[entry.timestamp.toISOString(), 'log', '(INFO)', 'a', 'b', 'c']
|
|
134
|
+
]);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
function createFakeConsole() {
|
|
138
|
+
const errors = [];
|
|
139
|
+
const infos = [];
|
|
140
|
+
const warns = [];
|
|
141
|
+
const debugs = [];
|
|
142
|
+
return {
|
|
143
|
+
errors,
|
|
144
|
+
infos,
|
|
145
|
+
warns,
|
|
146
|
+
debugs,
|
|
147
|
+
error(...args) { errors.push(args); },
|
|
148
|
+
info(...args) { infos.push(args); },
|
|
149
|
+
warn(...args) { warns.push(args); },
|
|
150
|
+
debug(...args) { debugs.push(args); }
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=createConsoleLogReporter.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createConsoleLogReporter.spec.js","sourceRoot":"","sources":["../../ts/console/createConsoleLogReporter.spec.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,WAAW,CAAA;AACzB,OAAO,EACL,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,EAAE,aAAa,EACxC,wBAAwB,EAClC,SAAS,EAAE,iBAAiB,EAAE,0BAA0B,EACpE,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AAEnC,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;IAE/B,IAAI,CAAC,0CAA0C,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AAG,IAAW,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC;KAC5C,CAAA;AACH,CAAC","sourcesContent":["import a from 'assertron'\nimport {\n addCustomLogLevel, clearCustomLogLevel, config, configForTest,\n ConsoleLogFormatter, createConsoleLogReporter,\n LogFilter, logLevels, plainLogFormatter, ProhibitedDuringProduction\n} from '../index.js'\nimport { store } from '../store.js'\n\ndescribe('production checks', () => {\n beforeEach(() => store.reset())\n\n test('set filter during production mode throws', () => {\n config({ mode: 'production' })\n const reporter = createConsoleLogReporter()\n a.throws(() => { reporter.filter = () => true }, ProhibitedDuringProduction)\n })\n\n const idFormatter: ConsoleLogFormatter = (entry) => [entry.id]\n test('set formatter during production mode throws', () => {\n config({ mode: 'production' })\n const reporter = createConsoleLogReporter()\n a.throws(() => reporter.formatter = idFormatter, ProhibitedDuringProduction)\n })\n})\n\n\ndescribe('unit tests', () => {\n beforeEach(() => configForTest())\n\n describe('rendering tests', () => {\n test('plain rendering', () => {\n const reporter = createConsoleLogReporter({ formatter: plainLogFormatter });\n ['emergency', 'info', 'warn', 'debug'].forEach(level => {\n reporter.write({ id: 'plain', level: (logLevels as any)[level], args: ['hello', 'world'], timestamp: new Date() })\n })\n })\n })\n\n describe('id', () => {\n test('default is \"console\"', () => {\n const reporter = createConsoleLogReporter()\n expect(reporter.id).toBe('console')\n })\n test('can be overridden', () => {\n const reporter = createConsoleLogReporter({ id: 'neo-console' })\n expect(reporter.id).toBe('neo-console')\n })\n })\n\n describe('log level', () => {\n test('error, alert, critical and emergency logs are written to console.error', () => {\n const id = 'log'\n const reporter = createConsoleLogReporter()\n const fakeConsole = reporter.console = createFakeConsole()\n\n reporter.write({ id, level: logLevels.emergency, args: ['emergency'], timestamp: new Date() })\n reporter.write({ id, level: logLevels.critical, args: ['critical'], timestamp: new Date() })\n reporter.write({ id, level: logLevels.alert, args: ['alert'], timestamp: new Date() })\n reporter.write({ id, level: logLevels.error, args: ['error'], timestamp: new Date() })\n\n expect(fakeConsole.errors.length).toBe(4)\n })\n\n test('warn logs are written to console.warn', () => {\n const id = 'log'\n const reporter = createConsoleLogReporter()\n\n const fakeConsole = reporter.console = createFakeConsole()\n\n reporter.write({ id, level: logLevels.warn, args: ['warn'], timestamp: new Date() })\n\n expect(fakeConsole.warns.length).toBe(1)\n })\n\n test('notice and info logs are written to console.info', () => {\n const id = 'log'\n const reporter = createConsoleLogReporter()\n\n const fakeConsole = reporter.console = createFakeConsole()\n\n reporter.write({ id, level: logLevels.notice, args: ['notice'], timestamp: new Date() })\n reporter.write({ id, level: logLevels.info, args: ['info'], timestamp: new Date() })\n\n expect(fakeConsole.infos.length).toBe(2)\n })\n\n\n test('debug, trace, and planck logs are written to console.debug', () => {\n const id = 'log'\n const reporter = createConsoleLogReporter()\n const fakeConsole = reporter.console = createFakeConsole()\n\n reporter.write({ id, level: logLevels.debug, args: ['debug'], timestamp: new Date() })\n reporter.write({ id, level: logLevels.trace, args: ['trace'], timestamp: new Date() })\n reporter.write({ id, level: logLevels.planck, args: ['planck'], timestamp: new Date() })\n\n expect(fakeConsole.debugs.length).toBe(3)\n })\n })\n\n describe('custom logs', () => {\n afterEach(() => clearCustomLogLevel())\n\n test('are written according to their log level value', () => {\n addCustomLogLevel('high', 50)\n addCustomLogLevel('important', 450)\n addCustomLogLevel('interest', 650)\n addCustomLogLevel('silly', 1000)\n\n const id = 'log'\n const reporter = createConsoleLogReporter()\n const fakeConsole = reporter.console = createFakeConsole()\n\n reporter.write({ id, level: 50, args: ['a'], timestamp: new Date() })\n reporter.write({ id, level: 450, args: ['b'], timestamp: new Date() })\n reporter.write({ id, level: 650, args: ['c'], timestamp: new Date() })\n reporter.write({ id, level: 1000, args: ['d'], timestamp: new Date() })\n\n expect(fakeConsole.errors.length).toBe(1)\n expect(fakeConsole.warns.length).toBe(1)\n expect(fakeConsole.infos.length).toBe(1)\n expect(fakeConsole.debugs.length).toBe(1)\n })\n })\n\n const idFormatter: ConsoleLogFormatter = (entry) => [entry.id]\n\n describe('formatter', () => {\n test('use specific formatter', () => {\n const id = 'id-only'\n const reporter = createConsoleLogReporter({ formatter: idFormatter })\n const fakeConsole = reporter.console = createFakeConsole()\n\n reporter.write({ id, level: logLevels.emergency, args: ['emergency'], timestamp: new Date() })\n\n expect(fakeConsole.errors).toEqual([['id-only']])\n })\n\n test('formatter can be changed afterward', () => {\n const reporter = createConsoleLogReporter()\n const formatter = reporter.formatter\n reporter.formatter = idFormatter\n expect(reporter.formatter).not.toEqual(formatter)\n })\n })\n\n describe('filter', () => {\n const filter: LogFilter = (entry) => entry.id !== 'secret'\n test('use specific filter', () => {\n const reporter = createConsoleLogReporter({ formatter: idFormatter, filter })\n const fakeConsole = reporter.console = createFakeConsole()\n\n reporter.write({ id: 'normal', level: logLevels.emergency, args: ['emergency'], timestamp: new Date() })\n reporter.write({ id: 'secret', level: logLevels.emergency, args: ['emergency'], timestamp: new Date() })\n\n expect(fakeConsole.errors).toEqual([['normal']])\n })\n\n test('can change filter', () => {\n const reporter = createConsoleLogReporter()\n const filter = reporter.filter\n reporter.filter = entry => entry.id !== 'secret'\n expect(reporter.filter).not.toEqual(filter)\n })\n })\n\n test('write log entry with multiple arguments', () => {\n const id = 'log'\n const reporter = createConsoleLogReporter({ formatter: plainLogFormatter })\n const fakeConsole = reporter.console = createFakeConsole()\n\n const entry = { id, level: logLevels.info, args: ['a', 'b', 'c'], timestamp: new Date() }\n\n reporter.write(entry)\n\n expect(fakeConsole.infos).toEqual([\n [entry.timestamp.toISOString(), 'log', '(INFO)', 'a', 'b', 'c']\n ])\n })\n})\n\n\nfunction createFakeConsole() {\n const errors: any[] = []\n const infos: any[] = []\n const warns: any[] = []\n const debugs: any[] = []\n return {\n errors,\n infos,\n warns,\n debugs,\n error(...args: any[]) { errors.push(args) },\n info(...args: any[]) { infos.push(args) },\n warn(...args: any[]) { warns.push(args) },\n debug(...args: any[]) { debugs.push(args) }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/console/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/console/index.ts"],"names":[],"mappings":"AAAA,cAAc,+BAA+B,CAAA;AAC7C,cAAc,sBAAsB,CAAA;AACpC,cAAc,YAAY,CAAA","sourcesContent":["export * from './createConsoleLogReporter.js'\nexport * from './toConsoleMethod.js'\nexport * from './types.js'\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConsoleDebugAvailable.d.ts","sourceRoot":"","sources":["../../ts/console/isConsoleDebugAvailable.ts"],"names":[],"mappings":"AAIA,wBAAgB,uBAAuB,YAMtC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import isNode from 'is-node';
|
|
2
|
+
import { semverGt } from './semverGt.js';
|
|
3
|
+
// istanbul ignore file
|
|
4
|
+
export function isConsoleDebugAvailable() {
|
|
5
|
+
if (!isNode)
|
|
6
|
+
return true;
|
|
7
|
+
// without this, systemJs will complain `process is not defined`
|
|
8
|
+
if (!global.process)
|
|
9
|
+
return true;
|
|
10
|
+
const versionString = process.version.startsWith('v') ? process.version.slice(1) : process.version;
|
|
11
|
+
return semverGt(versionString, [9, 3, 0]);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=isConsoleDebugAvailable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isConsoleDebugAvailable.js","sourceRoot":"","sources":["../../ts/console/isConsoleDebugAvailable.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,uBAAuB;AACvB,MAAM,UAAU,uBAAuB;IACrC,IAAI,CAAC,MAAM;QAAE,OAAO,IAAI,CAAA;IACxB,gEAAgE;IAChE,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,OAAO,IAAI,CAAA;IAChC,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAA;IAClG,OAAO,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;AAC3C,CAAC","sourcesContent":["import isNode from 'is-node'\nimport { semverGt } from './semverGt.js'\n\n// istanbul ignore file\nexport function isConsoleDebugAvailable() {\n if (!isNode) return true\n // without this, systemJs will complain `process is not defined`\n if (!global.process) return true\n const versionString = process.version.startsWith('v') ? process.version.slice(1) : process.version\n return semverGt(versionString, [9, 3, 0])\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfilledConsole.d.ts","sourceRoot":"","sources":["../../ts/console/polyfilledConsole.ts"],"names":[],"mappings":"AAiCA,eAAO,MAAM,iBAAiB;;;;;CAAyB,CAAA"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
import { isConsoleDebugAvailable } from './isConsoleDebugAvailable.js';
|
|
3
|
+
/* eslint-disable no-console */
|
|
4
|
+
function buildPolyfillConsole() {
|
|
5
|
+
// old phantomjs does not have bind function
|
|
6
|
+
const hasBind = !!console.log.bind;
|
|
7
|
+
if (hasBind) {
|
|
8
|
+
return {
|
|
9
|
+
// Node@9.3 or below has `console.debug = undefined` or it doesn't log
|
|
10
|
+
// Should use `console.log()` in those case.
|
|
11
|
+
debug: (isConsoleDebugAvailable() ? console.debug : console.log).bind(console),
|
|
12
|
+
// the `typeof` guards against IE where `console.log.apply()`
|
|
13
|
+
// results in error `Object doesn't support property or method 'apply'`
|
|
14
|
+
info: (typeof console.info === 'function' ? console.info : console.log).bind(console),
|
|
15
|
+
warn: (typeof console.warn === 'function' ? console.warn : console.log).bind(console),
|
|
16
|
+
error: (typeof console.error === 'function' ? console.error : console.log).bind(console)
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return {
|
|
21
|
+
debug: buildFn(isConsoleDebugAvailable() ? 'debug' : 'log'),
|
|
22
|
+
info: buildFn(typeof console.info === 'function' ? 'info' : 'log'),
|
|
23
|
+
warn: buildFn(typeof console.warn === 'function' ? 'warn' : 'log'),
|
|
24
|
+
error: buildFn(typeof console.error === 'function' ? 'error' : 'log'),
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function buildFn(name) {
|
|
29
|
+
return function (...args) { console[name](...args); };
|
|
30
|
+
}
|
|
31
|
+
export const polyfilledConsole = buildPolyfillConsole();
|
|
32
|
+
//# sourceMappingURL=polyfilledConsole.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"polyfilledConsole.js","sourceRoot":"","sources":["../../ts/console/polyfilledConsole.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAA;AACtE,+BAA+B;AAE/B,SAAS,oBAAoB;IAC3B,4CAA4C;IAC5C,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,IAAe,CAAA;IAC7C,IAAI,OAAO,EAAE;QACX,OAAO;YACL,sEAAsE;YACtE,4CAA4C;YAC5C,KAAK,EAAE,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;YAC9E,6DAA6D;YAC7D,uEAAuE;YACvE,IAAI,EAAE,CAAC,OAAO,OAAO,CAAC,IAAI,K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isConsoleDebugAvailable.js'\n/* eslint-disable no-console */\n\nfunction buildPolyfillConsole() {\n // old phantomjs does not have bind function\n const hasBind = !!console.log.bind as boolean\n if (hasBind) {\n return {\n // Node@9.3 or below has `console.debug = undefined` or it doesn't log\n // Should use `console.log()` in those case.\n debug: (isConsoleDebugAvailable() ? console.debug : console.log).bind(console),\n // the `typeof` guards against IE where `console.log.apply()`\n // results in error `Object doesn't support property or method 'apply'`\n info: (typeof console.info === 'function' ? console.info : console.log).bind(console),\n warn: (typeof console.warn === 'function' ? console.warn : console.log).bind(console),\n error: (typeof console.error === 'function' ? console.error : console.log).bind(console)\n }\n }\n else {\n return {\n debug: buildFn(isConsoleDebugAvailable() ? 'debug' : 'log'),\n info: buildFn(typeof console.info === 'function' ? 'info' : 'log'),\n warn: buildFn(typeof console.warn === 'function' ? 'warn' : 'log'),\n error: buildFn(typeof console.error === 'function' ? 'error' : 'log'),\n }\n }\n}\n\nfunction buildFn(name: 'debug' | 'info' | 'warn' | 'error' | 'log') {\n return function (...args: any[]) { console[name](...args) }\n}\n\nexport const polyfilledConsole = buildPolyfillConsole()\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semverGt.d.ts","sourceRoot":"","sources":["../../ts/console/semverGt.ts"],"names":[],"mappings":"AACA,wBAAgB,QAAQ,CAAC,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,WAOhF"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semverGt.js","sourceRoot":"","sources":["../../ts/console/semverGt.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,MAAM,UAAU,QAAQ,CAAC,aAAqB,EAAE,OAAiC;IAC/E,MAAM,MAAM,GAAG,aAAa,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,EAAE;QACnE,CAAC,IAAI,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,CAAA;QAC9C,OAAO,CAAC,CAAA;IACV,CAAC,EAAE,CAAC,CAAC,CAAA;IAEL,OAAO,MAAM,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAA;AACtE,CAAC","sourcesContent":["// istanbul ignore next\nexport function semverGt(versionString: string, version: [number, number, number]) {\n const actual = versionString.split('.').reverse().reduce((p, v, i) => {\n p += Number.parseInt(v, 10) * Math.pow(100, i)\n return p\n }, 0)\n\n return actual > (version[0] * 10000 + version[1] * 100 + version[2])\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semverGt.spec.d.ts","sourceRoot":"","sources":["../../ts/console/semverGt.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { semverGt } from './semverGt.js';
|
|
2
|
+
test('9.3.0 returns false', () => {
|
|
3
|
+
expect(semverGt('9.3.0', [9, 3, 0])).toBe(false);
|
|
4
|
+
});
|
|
5
|
+
test('9.3.1 returns true', () => {
|
|
6
|
+
expect(semverGt('9.3.1', [9, 3, 0])).toBe(true);
|
|
7
|
+
});
|
|
8
|
+
test('9.3.1 returns true', () => {
|
|
9
|
+
expect(semverGt('9.3.1', [9, 3, 0])).toBe(true);
|
|
10
|
+
});
|
|
11
|
+
test('9.4.0 returns true', () => {
|
|
12
|
+
expect(semverGt('9.4.0', [9, 3, 0])).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
test('9.10.0 returns true', () => {
|
|
15
|
+
expect(semverGt('9.10.0', [9, 3, 0])).toBe(true);
|
|
16
|
+
});
|
|
17
|
+
test('10.0.0 returns true', () => {
|
|
18
|
+
expect(semverGt('10.0.0', [9, 3, 0])).toBe(true);
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=semverGt.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"semverGt.spec.js","sourceRoot":"","sources":["../../ts/console/semverGt.spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAExC,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE;IAC/B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;AAClD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAC9B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACjD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAC9B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACjD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAC9B,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AACjD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE;IAC/B,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAClD,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,qBAAqB,EAAE,GAAG,EAAE;IAC/B,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAClD,CAAC,CAAC,CAAA","sourcesContent":["import { semverGt } from './semverGt.js'\n\ntest('9.3.0 returns false', () => {\n expect(semverGt('9.3.0', [9, 3, 0])).toBe(false)\n})\n\ntest('9.3.1 returns true', () => {\n expect(semverGt('9.3.1', [9, 3, 0])).toBe(true)\n})\n\ntest('9.3.1 returns true', () => {\n expect(semverGt('9.3.1', [9, 3, 0])).toBe(true)\n})\n\ntest('9.4.0 returns true', () => {\n expect(semverGt('9.4.0', [9, 3, 0])).toBe(true)\n})\n\ntest('9.10.0 returns true', () => {\n expect(semverGt('9.10.0', [9, 3, 0])).toBe(true)\n})\n\ntest('10.0.0 returns true', () => {\n expect(semverGt('10.0.0', [9, 3, 0])).toBe(true)\n})\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toConsoleMethod.d.ts","sourceRoot":"","sources":["../../ts/console/toConsoleMethod.ts"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,uCAe5C"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { logLevels } from '../logLevel.js';
|
|
2
|
+
export function toConsoleMethod(level) {
|
|
3
|
+
switch (true) {
|
|
4
|
+
// istanbul ignore next
|
|
5
|
+
case (level === 0):
|
|
6
|
+
// edge case in case none is somehow written
|
|
7
|
+
return 'debug';
|
|
8
|
+
case (level <= logLevels.error):
|
|
9
|
+
return 'error';
|
|
10
|
+
case (level <= logLevels.warn):
|
|
11
|
+
return 'warn';
|
|
12
|
+
case (level <= logLevels.info):
|
|
13
|
+
return 'info';
|
|
14
|
+
default:
|
|
15
|
+
return 'debug';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=toConsoleMethod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toConsoleMethod.js","sourceRoot":"","sources":["../../ts/console/toConsoleMethod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAE1C,MAAM,UAAU,eAAe,CAAC,KAAa;IAC3C,QAAQ,IAAI,EAAE;QACZ,uBAAuB;QACvB,KAAK,CAAC,KAAK,KAAK,CAAC,CAAC;YAChB,4CAA4C;YAC5C,OAAO,OAAO,CAAA;QAChB,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC;YAC7B,OAAO,OAAO,CAAA;QAChB,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC;YAC5B,OAAO,MAAM,CAAA;QACf,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,IAAI,CAAC;YAC5B,OAAO,MAAM,CAAA;QACf;YACE,OAAO,OAAO,CAAA;KACjB;AACH,CAAC","sourcesContent":["import { logLevels } from '../logLevel.js'\n\nexport function toConsoleMethod(level: number) {\n switch (true) {\n // istanbul ignore next\n case (level === 0):\n // edge case in case none is somehow written\n return 'debug'\n case (level <= logLevels.error):\n return 'error'\n case (level <= logLevels.warn):\n return 'warn'\n case (level <= logLevels.info):\n return 'info'\n default:\n return 'debug'\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../ts/console/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAA;AAE1D,oBAAY,OAAO,GAAG,OAAO,iBAAiB,CAAA"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../ts/console/types.ts"],"names":[],"mappings":"","sourcesContent":["import { polyfilledConsole } from './polyfilledConsole.js'\n\nexport type Console = typeof polyfilledConsole\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LogLevelEntry } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* @param level the `logLevel` number.
|
|
4
|
+
* You can specify this in the form of `logLevel.<x> + n` to make it more readable.
|
|
5
|
+
*/
|
|
6
|
+
export declare function addCustomLogLevel(name: string, level: number): void;
|
|
7
|
+
export declare function clearCustomLogLevel(): void;
|
|
8
|
+
export declare function getCustomLevel(name: string): number | undefined;
|
|
9
|
+
export declare function getCustomLevelName(level: number): string | undefined;
|
|
10
|
+
export declare function getCustomLevels(): LogLevelEntry[];
|
|
11
|
+
//# sourceMappingURL=customLogLevel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customLogLevel.d.ts","sourceRoot":"","sources":["../ts/customLogLevel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AAE1C;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAM5D;AAED,wBAAgB,mBAAmB,SAKlC;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAE/D;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED,wBAAgB,eAAe,IAAI,aAAa,EAAE,CAGjD"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { forEachKey, mapKey } from 'type-plus';
|
|
2
|
+
import { store } from './store.js';
|
|
3
|
+
/**
|
|
4
|
+
* @param level the `logLevel` number.
|
|
5
|
+
* You can specify this in the form of `logLevel.<x> + n` to make it more readable.
|
|
6
|
+
*/
|
|
7
|
+
export function addCustomLogLevel(name, level) {
|
|
8
|
+
const { customLevels, customLevelsReverse } = store.value;
|
|
9
|
+
customLevels[name] = level;
|
|
10
|
+
customLevelsReverse[level] = name;
|
|
11
|
+
const { loggerClosures } = store.value;
|
|
12
|
+
forEachKey(loggerClosures, id => loggerClosures[id].addMethod(name, level));
|
|
13
|
+
}
|
|
14
|
+
export function clearCustomLogLevel() {
|
|
15
|
+
const { customLevels, customLevelsReverse } = store.value;
|
|
16
|
+
// Don't replace the object would prevent reference divergence
|
|
17
|
+
forEachKey(customLevels, k => delete customLevels[k]);
|
|
18
|
+
customLevelsReverse.splice(0, customLevelsReverse.length);
|
|
19
|
+
}
|
|
20
|
+
export function getCustomLevel(name) {
|
|
21
|
+
return store.value.customLevels[name];
|
|
22
|
+
}
|
|
23
|
+
export function getCustomLevelName(level) {
|
|
24
|
+
return store.value.customLevelsReverse[level];
|
|
25
|
+
}
|
|
26
|
+
export function getCustomLevels() {
|
|
27
|
+
const { customLevels } = store.value;
|
|
28
|
+
return mapKey(customLevels, name => ({ name, level: customLevels[name] }));
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=customLogLevel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customLogLevel.js","sourceRoot":"","sources":["../ts/customLogLevel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAGlC;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,KAAa;IAC3D,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC,KAAK,CAAA;IACzD,YAAY,CAAC,IAAI,CAAC,GAAG,KAAK,CAAA;IAC1B,mBAAmB,CAAC,KAAK,CAAC,GAAG,IAAI,CAAA;IACjC,MAAM,EAAE,cAAc,EAAE,GAAG,KAAK,CAAC,KAAK,CAAA;IACtC,UAAU,CAAC,cAAc,EAAE,EAAE,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAA;AAC7E,CAAC;AAED,MAAM,UAAU,mBAAmB;IACjC,MAAM,EAAE,YAAY,EAAE,mBAAmB,EAAE,GAAG,KAAK,CAAC,KAAK,CAAA;IACzD,8DAA8D;IAC9D,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,CAAC,CAAC,CAAA;IACrD,mBAAmB,CAAC,MAAM,CAAC,CAAC,EAAE,mBAAmB,CAAC,MAAM,CAAC,CAAA;AAC3D,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,KAAK,CAAC,KAAK,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;AACvC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,KAAa;IAC9C,OAAO,KAAK,CAAC,KAAK,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAA;AAC/C,CAAC;AAED,MAAM,UAAU,eAAe;IAC7B,MAAM,EAAE,YAAY,EAAE,GAAG,KAAK,CAAC,KAAK,CAAA;IACpC,OAAO,MAAM,CAAC,YAAY,EAAE,IAAI,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;AAC5E,CAAC","sourcesContent":["import { forEachKey, mapKey } from 'type-plus'\nimport { store } from './store.js'\nimport { LogLevelEntry } from './types.js'\n\n/**\n * @param level the `logLevel` number.\n * You can specify this in the form of `logLevel.<x> + n` to make it more readable.\n */\nexport function addCustomLogLevel(name: string, level: number) {\n const { customLevels, customLevelsReverse } = store.value\n customLevels[name] = level\n customLevelsReverse[level] = name\n const { loggerClosures } = store.value\n forEachKey(loggerClosures, id => loggerClosures[id].addMethod(name, level))\n}\n\nexport function clearCustomLogLevel() {\n const { customLevels, customLevelsReverse } = store.value\n // Don't replace the object would prevent reference divergence\n forEachKey(customLevels, k => delete customLevels[k])\n customLevelsReverse.splice(0, customLevelsReverse.length)\n}\n\nexport function getCustomLevel(name: string): number | undefined {\n return store.value.customLevels[name]\n}\n\nexport function getCustomLevelName(level: number): string | undefined {\n return store.value.customLevelsReverse[level]\n}\n\nexport function getCustomLevels(): LogLevelEntry[] {\n const { customLevels } = store.value\n return mapKey(customLevels, name => ({ name, level: customLevels[name] }))\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customLogLevel.spec.d.ts","sourceRoot":"","sources":["../ts/customLogLevel.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import a from 'assertron';
|
|
2
|
+
import { addCustomLogLevel, clearCustomLogLevel, getCustomLevels, getLogger, logLevels } from './index.js';
|
|
3
|
+
import { config } from './config.js';
|
|
4
|
+
import { createMemoryLogReporter } from './memory/index.js';
|
|
5
|
+
import { store } from './store.js';
|
|
6
|
+
afterEach(() => store.reset());
|
|
7
|
+
describe('clearCustomLogLevel()', () => {
|
|
8
|
+
test('clear all custom levels', () => {
|
|
9
|
+
addCustomLogLevel('c1', logLevels.none + 1);
|
|
10
|
+
addCustomLogLevel('c2', logLevels.none + 2);
|
|
11
|
+
expect(getCustomLevels().length).toBe(2);
|
|
12
|
+
clearCustomLogLevel();
|
|
13
|
+
expect(getCustomLevels().length).toBe(0);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
test('custom level will not write if log level is lower', () => {
|
|
17
|
+
const memReporter = createMemoryLogReporter();
|
|
18
|
+
config({
|
|
19
|
+
mode: 'test',
|
|
20
|
+
reporters: [memReporter]
|
|
21
|
+
});
|
|
22
|
+
addCustomLogLevel('c1', logLevels.debug + 1);
|
|
23
|
+
const log = getLogger('custom-level-not-write');
|
|
24
|
+
log.c1('will not write this');
|
|
25
|
+
expect(memReporter.logs.length).toEqual(0);
|
|
26
|
+
});
|
|
27
|
+
test('custom level method is readonly', () => {
|
|
28
|
+
addCustomLogLevel('c1', logLevels.debug + 1);
|
|
29
|
+
const log = getLogger('custom method readonly');
|
|
30
|
+
a.throws(() => { log.c1 = () => { }; });
|
|
31
|
+
});
|
|
32
|
+
//# sourceMappingURL=customLogLevel.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customLogLevel.spec.js","sourceRoot":"","sources":["../ts/customLogLevel.spec.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,WAAW,CAAA;AACzB,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAC1G,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAA;AAElC,SAAS,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC,CAAA;AAE9B,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,IAAI,CAAC,yBAAyB,EAAE,GAAG,EAAE;QACnC,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;QAC3C,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,GAAG,CAAC,CAAC,CAAA;QAC3C,MAAM,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAExC,mBAAmB,EAAE,CAAA;QAErB,MAAM,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,mDAAmD,EAAE,GAAG,EAAE;IAC7D,MAAM,WAAW,GAAG,uBAAuB,EAAE,CAAA;IAC7C,MAAM,CAAC;QACL,IAAI,EAAE,MAAM;QACZ,SAAS,EAAE,CAAC,WAAW,CAAC;KACzB,CAAC,CAAA;IAEF,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC5C,MAAM,GAAG,GAAG,SAAS,CAAO,wBAAwB,CAAC,CAAA;IACrD,GAAG,CAAC,EAAE,CAAC,qBAAqB,CAAC,CAAA;IAE7B,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAC5C,CAAC,CAAC,CAAA;AAEF,IAAI,CAAC,iCAAiC,EAAE,GAAG,EAAE;IAC3C,iBAAiB,CAAC,IAAI,EAAE,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAA;IAC5C,MAAM,GAAG,GAAG,SAAS,CAAO,wBAAwB,CAAC,CAAA;IACrD,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,EAAE,GAAG,CAAC,CAAA,CAAC,CAAC,CAAC,CAAA;AACxC,CAAC,CAAC,CAAA","sourcesContent":["import a from 'assertron'\nimport { addCustomLogLevel, clearCustomLogLevel, getCustomLevels, getLogger, logLevels } from './index.js'\nimport { config } from './config.js'\nimport { createMemoryLogReporter } from './memory/index.js'\nimport { store } from './store.js'\n\nafterEach(() => store.reset())\n\ndescribe('clearCustomLogLevel()', () => {\n test('clear all custom levels', () => {\n addCustomLogLevel('c1', logLevels.none + 1)\n addCustomLogLevel('c2', logLevels.none + 2)\n expect(getCustomLevels().length).toBe(2)\n\n clearCustomLogLevel()\n\n expect(getCustomLevels().length).toBe(0)\n })\n})\n\ntest('custom level will not write if log level is lower', () => {\n const memReporter = createMemoryLogReporter()\n config({\n mode: 'test',\n reporters: [memReporter]\n })\n\n addCustomLogLevel('c1', logLevels.debug + 1)\n const log = getLogger<'c1'>('custom-level-not-write')\n log.c1('will not write this')\n\n expect(memReporter.logs.length).toEqual(0)\n})\n\ntest('custom level method is readonly', () => {\n addCustomLogLevel('c1', logLevels.debug + 1)\n const log = getLogger<'c1'>('custom method readonly')\n a.throws(() => { log.c1 = () => { } })\n})\n"]}
|
package/{libm → esm}/errors.d.ts
RENAMED
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAEjD,qBAAa,gBAAiB,SAAQ,WAAW;gBACnC,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,CAAC,OAAO;CAG5D;AACD,qBAAa,SAAU,SAAQ,gBAAgB;IAC1B,EAAE,EAAE,MAAM;gBAAV,EAAE,EAAE,MAAM;CAG9B;AAED,qBAAa,0BAA2B,SAAQ,gBAAgB;IAC3C,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM;CAGlC;AAED,qBAAa,aAAc,SAAQ,gBAAgB;IAC9B,IAAI,EAAE,MAAM;IAAS,KAAK,EAAE,MAAM;IAAS,cAAc,EAAE,MAAM,EAAE;gBAAnE,IAAI,EAAE,MAAM,EAAS,KAAK,EAAE,MAAM,EAAS,cAAc,EAAE,MAAM,EAAE;CAGvF"}
|
package/esm/errors.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ModuleError } from 'iso-error';
|
|
2
|
+
export class StandardLogError extends ModuleError {
|
|
3
|
+
constructor(description, options) {
|
|
4
|
+
super('standard-log', description, options);
|
|
5
|
+
}
|
|
6
|
+
}
|
|
7
|
+
export class InvalidId extends StandardLogError {
|
|
8
|
+
constructor(id) {
|
|
9
|
+
super(`logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ${id}`);
|
|
10
|
+
Object.defineProperty(this, "id", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
configurable: true,
|
|
13
|
+
writable: true,
|
|
14
|
+
value: id
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export class ProhibitedDuringProduction extends StandardLogError {
|
|
19
|
+
constructor(action) {
|
|
20
|
+
super(`Cannot perform ${action} during production`);
|
|
21
|
+
Object.defineProperty(this, "action", {
|
|
22
|
+
enumerable: true,
|
|
23
|
+
configurable: true,
|
|
24
|
+
writable: true,
|
|
25
|
+
value: action
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export class InvalidEnvVar extends StandardLogError {
|
|
30
|
+
constructor(name, value, possibleValues) {
|
|
31
|
+
super(`${name} contains invalid value '${value}'${` valid values: [${possibleValues.join()}]`}`);
|
|
32
|
+
Object.defineProperty(this, "name", {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
configurable: true,
|
|
35
|
+
writable: true,
|
|
36
|
+
value: name
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(this, "value", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
configurable: true,
|
|
41
|
+
writable: true,
|
|
42
|
+
value: value
|
|
43
|
+
});
|
|
44
|
+
Object.defineProperty(this, "possibleValues", {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
configurable: true,
|
|
47
|
+
writable: true,
|
|
48
|
+
value: possibleValues
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../ts/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,WAAW,EAAE,MAAM,WAAW,CAAA;AAEjD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C,YAAY,WAAmB,EAAE,OAA0B;QACzD,KAAK,CAAC,cAAc,EAAE,WAAW,EAAE,OAAO,CAAC,CAAA;IAC7C,CAAC;CACF;AACD,MAAM,OAAO,SAAU,SAAQ,gBAAgB;IAC7C,YAAmB,EAAU;QAC3B,KAAK,CAAC,kFAAkF,EAAE,EAAE,CAAC,CAAA;;;;;mBAD5E;;IAEnB,CAAC;CACF;AAED,MAAM,OAAO,0BAA2B,SAAQ,gBAAgB;IAC9D,YAAmB,MAAc;QAC/B,KAAK,CAAC,kBAAkB,MAAM,oBAAoB,CAAC,CAAA;;;;;mBADlC;;IAEnB,CAAC;CACF;AAED,MAAM,OAAO,aAAc,SAAQ,gBAAgB;IACjD,YAAmB,IAAY,EAAS,KAAa,EAAS,cAAwB;QACpF,KAAK,CAAC,GAAG,IAAI,4BAA4B,KAAK,IAAI,mBAAmB,cAAc,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAA;;;;;mBAD/E;;;;;;mBAAqB;;;;;;mBAAsB;;IAE9D,CAAC;CACF","sourcesContent":["import { IsoError, ModuleError } from 'iso-error'\n\nexport class StandardLogError extends ModuleError {\n constructor(description: string, options?: IsoError.Options) {\n super('standard-log', description, options)\n }\n}\nexport class InvalidId extends StandardLogError {\n constructor(public id: string) {\n super(`logger id only supports alphanumeric, unicode characters, and [:_-.]. Received ${id}`)\n }\n}\n\nexport class ProhibitedDuringProduction extends StandardLogError {\n constructor(public action: string) {\n super(`Cannot perform ${action} during production`)\n }\n}\n\nexport class InvalidEnvVar extends StandardLogError {\n constructor(public name: string, public value: string, public possibleValues: string[]) {\n super(`${name} contains invalid value '${value}'${` valid values: [${possibleValues.join()}]`}`)\n }\n}\n"]}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTimestampFormatter.d.ts","sourceRoot":"","sources":["../../ts/formatter/createTimestampFormatter.ts"],"names":[],"mappings":"AAEA,oBAAY,eAAe,GAAG,MAAM,GAAG,KAAK,GAAG,SAAS,CAAA;AAExD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,eAAe,iBAGtC,IAAI,+BAEL,IAAI,aAW5B"}
|
|
File without changes
|