standard-log 12.1.2 → 13.0.1

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.
Files changed (144) hide show
  1. package/README.md +8 -8
  2. package/cjs/_virtual/_rolldown/runtime.js +23 -0
  3. package/cjs/console.d.ts +10 -7
  4. package/cjs/console.d.ts.map +1 -1
  5. package/cjs/console.js +53 -71
  6. package/cjs/console.js.map +1 -1
  7. package/cjs/errors.d.ts +9 -6
  8. package/cjs/errors.d.ts.map +1 -1
  9. package/cjs/errors.js +22 -45
  10. package/cjs/errors.js.map +1 -1
  11. package/cjs/formatter.d.ts +9 -6
  12. package/cjs/formatter.d.ts.map +1 -1
  13. package/cjs/formatter.js +41 -50
  14. package/cjs/formatter.js.map +1 -1
  15. package/cjs/index.d.ts +8 -9
  16. package/cjs/index.js +26 -28
  17. package/cjs/log_levels.d.ts +76 -73
  18. package/cjs/log_levels.d.ts.map +1 -1
  19. package/cjs/log_levels.js +104 -110
  20. package/cjs/log_levels.js.map +1 -1
  21. package/cjs/log_store.d.ts +20 -17
  22. package/cjs/log_store.d.ts.map +1 -1
  23. package/cjs/log_store.js +43 -39
  24. package/cjs/log_store.js.map +1 -1
  25. package/cjs/logger.d.ts +6 -3
  26. package/cjs/logger.d.ts.map +1 -1
  27. package/cjs/logger.js +66 -88
  28. package/cjs/logger.js.map +1 -1
  29. package/cjs/memory.d.ts +20 -17
  30. package/cjs/memory.d.ts.map +1 -1
  31. package/cjs/memory.js +54 -64
  32. package/cjs/memory.js.map +1 -1
  33. package/cjs/platform.browser.d.ts +7 -4
  34. package/cjs/platform.browser.d.ts.map +1 -1
  35. package/cjs/platform.browser.js +8 -6
  36. package/cjs/platform.browser.js.map +1 -1
  37. package/cjs/platform.d.ts +7 -4
  38. package/cjs/platform.d.ts.map +1 -1
  39. package/cjs/platform.js +9 -7
  40. package/cjs/platform.js.map +1 -1
  41. package/cjs/standard_log.ctx.d.ts +11 -8
  42. package/cjs/standard_log.ctx.d.ts.map +1 -1
  43. package/cjs/standard_log.ctx.js +6 -5
  44. package/cjs/standard_log.ctx.js.map +1 -1
  45. package/cjs/standard_log.d.ts +14 -12
  46. package/cjs/standard_log.d.ts.map +1 -1
  47. package/cjs/standard_log.js +83 -112
  48. package/cjs/standard_log.js.map +1 -1
  49. package/cjs/standard_log.testing.d.ts +16 -13
  50. package/cjs/standard_log.testing.d.ts.map +1 -1
  51. package/cjs/standard_log.testing.js +19 -35
  52. package/cjs/standard_log.testing.js.map +1 -1
  53. package/cjs/testing/index.d.ts +3 -3
  54. package/cjs/testing/index.js +3 -6
  55. package/cjs/types.d.ts +125 -124
  56. package/cjs/types.d.ts.map +1 -1
  57. package/cjs/types.js +0 -3
  58. package/dist/standard-log.esm.js +873 -1430
  59. package/dist/standard-log.esm.js.map +1 -1
  60. package/dist/standard-log.iife.js +952 -0
  61. package/dist/standard-log.iife.js.map +1 -0
  62. package/esm/console.d.ts +10 -7
  63. package/esm/console.d.ts.map +1 -1
  64. package/esm/console.js +54 -64
  65. package/esm/console.js.map +1 -1
  66. package/esm/errors.d.ts +9 -6
  67. package/esm/errors.d.ts.map +1 -1
  68. package/esm/errors.js +21 -21
  69. package/esm/errors.js.map +1 -1
  70. package/esm/formatter.d.ts +9 -6
  71. package/esm/formatter.d.ts.map +1 -1
  72. package/esm/formatter.js +38 -32
  73. package/esm/formatter.js.map +1 -1
  74. package/esm/index.d.ts +8 -9
  75. package/esm/index.js +7 -7
  76. package/esm/log_levels.d.ts +76 -73
  77. package/esm/log_levels.d.ts.map +1 -1
  78. package/esm/log_levels.js +102 -107
  79. package/esm/log_levels.js.map +1 -1
  80. package/esm/log_store.d.ts +20 -17
  81. package/esm/log_store.d.ts.map +1 -1
  82. package/esm/log_store.js +44 -37
  83. package/esm/log_store.js.map +1 -1
  84. package/esm/logger.d.ts +6 -3
  85. package/esm/logger.d.ts.map +1 -1
  86. package/esm/logger.js +66 -65
  87. package/esm/logger.js.map +1 -1
  88. package/esm/memory.d.ts +20 -17
  89. package/esm/memory.d.ts.map +1 -1
  90. package/esm/memory.js +55 -62
  91. package/esm/memory.js.map +1 -1
  92. package/esm/platform.browser.d.ts +7 -4
  93. package/esm/platform.browser.d.ts.map +1 -1
  94. package/esm/platform.browser.js +7 -3
  95. package/esm/platform.browser.js.map +1 -1
  96. package/esm/platform.d.ts +7 -4
  97. package/esm/platform.d.ts.map +1 -1
  98. package/esm/platform.js +8 -4
  99. package/esm/platform.js.map +1 -1
  100. package/esm/standard_log.ctx.d.ts +11 -8
  101. package/esm/standard_log.ctx.d.ts.map +1 -1
  102. package/esm/standard_log.ctx.js +6 -2
  103. package/esm/standard_log.ctx.js.map +1 -1
  104. package/esm/standard_log.d.ts +14 -12
  105. package/esm/standard_log.d.ts.map +1 -1
  106. package/esm/standard_log.js +83 -98
  107. package/esm/standard_log.js.map +1 -1
  108. package/esm/standard_log.testing.d.ts +16 -13
  109. package/esm/standard_log.testing.d.ts.map +1 -1
  110. package/esm/standard_log.testing.js +19 -20
  111. package/esm/standard_log.testing.js.map +1 -1
  112. package/esm/testing/index.d.ts +3 -3
  113. package/esm/testing/index.js +2 -2
  114. package/esm/types.d.ts +125 -124
  115. package/esm/types.d.ts.map +1 -1
  116. package/esm/types.js +0 -1
  117. package/package.json +21 -67
  118. package/ts/console.ts +7 -8
  119. package/ts/errors.ts +5 -2
  120. package/ts/formatter.ts +1 -2
  121. package/ts/index.ts +3 -3
  122. package/ts/log_levels.ts +2 -2
  123. package/ts/logger.ts +14 -7
  124. package/ts/memory.ts +3 -5
  125. package/ts/platform.ts +1 -1
  126. package/ts/standard_log.ts +2 -2
  127. package/ts/testing/index.ts +3 -3
  128. package/ts/types.ts +1 -1
  129. package/cjs/index.d.ts.map +0 -1
  130. package/cjs/index.js.map +0 -1
  131. package/cjs/testing/index.d.ts.map +0 -1
  132. package/cjs/testing/index.js.map +0 -1
  133. package/cjs/types.js.map +0 -1
  134. package/dist/standard-log.es5.js +0 -10184
  135. package/dist/standard-log.es5.js.gz +0 -0
  136. package/dist/standard-log.es5.js.map +0 -1
  137. package/dist/standard-log.es5.js.map.gz +0 -0
  138. package/dist/standard-log.esm.js.gz +0 -0
  139. package/dist/standard-log.esm.js.map.gz +0 -0
  140. package/esm/index.d.ts.map +0 -1
  141. package/esm/index.js.map +0 -1
  142. package/esm/testing/index.d.ts.map +0 -1
  143. package/esm/testing/index.js.map +0 -1
  144. package/esm/types.js.map +0 -1
Binary file
Binary file
Binary file
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC5F,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/D,YAAY,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,aAAa,EACb,SAAS,EACT,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,MAAM,YAAY,CAAA"}
package/esm/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../ts/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA","sourcesContent":["export * from './console.js'\nexport * from './errors.js'\nexport * from './formatter.js'\nexport * from './log_levels.js'\nexport * from './memory.js'\nexport { configGlobal, createStandardLog, getLogger, suppressLogs } from './standard_log.js'\nexport type { GetLogger, StandardLog } from './standard_log.js'\nexport type {\n\tConsoleLike,\n\tLogEntry,\n\tLogFilter,\n\tLogFormatter,\n\tLogFunction,\n\tLogLevel,\n\tLogLevelEntry,\n\tLogMethod,\n\tLogMethodNames,\n\tLogReporter,\n\tLogReporterOptions,\n\tLogger,\n\tLoggerOptions,\n\tReporterFilter,\n\tStandardLogInstance,\n\tStandardLogOptions\n} from './types.js'\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../ts/testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAA;AACrD,OAAO,EACN,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,kBAAkB,EACvB,MAAM,4BAA4B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../ts/testing/index.ts"],"names":[],"mappings":"AACA,OAAO,EACN,wBAAwB,EAGxB,MAAM,4BAA4B,CAAA","sourcesContent":["export { type MemoryLogReporter } from '../memory.js'\nexport {\n\tcreateStandardLogForTest,\n\ttype StandardLogForTestOptions,\n\ttype StandardLogForTest\n} from '../standard_log.testing.js'\n"]}
package/esm/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../ts/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { StackTraceMeta } from '@just-func/types'\n\nexport type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {\n\t/**\n\t * A map of custom log levels.\n\t *\n\t * Each logger created will have a method for each custom level.\n\t *\n\t * ```ts\n\t * import { createStandardLog } from 'standard-log'\n\t *\n\t * const sl = createStandardLog({ customLevels: { foo: 100 } })\n\t * const logger = sl.getLogger('my-logger')\n\t *\n\t * logger.foo('Hello world!') // 2020-01-01T00:00:00.000Z my-logger (FOO) Hello world!\n\t * ```\n\t */\n\tcustomLevels?: Record<CustomLevelNames, number>\n\tlogLevel?: number\n\treporters?: LogReporter[]\n}\n\nexport interface LoggerOptions extends StackTraceMeta {\n\tlevel?: number\n\twriteTo?: LogReporter | ReporterFilter\n}\n\nexport type Logger<N extends string = LogMethodNames> = {\n\treadonly id: string\n\t/**\n\t * Logger local log level.\n\t */\n\tlevel?: number\n\t/**\n\t * Logs with an increment counter.\n\t * This is useful during debugging to check for steps executed.\n\t */\n\tcount(...args: any[]): void\n\ton(level: number | N, logFunction: LogFunction): void\n\t/**\n\t * Write custom log entries.\n\t */\n\twrite(entry: LogEntry): void\n} & { [k in N]: LogMethod }\n\n/**\n * Names of the standard log methods.\n */\nexport type LogMethodNames =\n\t| 'emergency'\n\t| 'alert'\n\t| 'critical'\n\t| 'error'\n\t| 'warn'\n\t| 'notice'\n\t| 'info'\n\t| 'debug'\n\t| 'trace'\n\t| 'planck'\n\nexport type LogEntry = {\n\tid: string\n\tlevel: number\n\t// args instead of messages because it is `any[]` instead of `string[]`\n\targs: any[]\n\ttimestamp: Date\n}\n\nexport type LogMethod = (...args: any[]) => void\n\nexport type LogFunction = (log: LogMethod, logLevel: number) => string | void\n\nexport type ReporterFilter = string | RegExp | ((reporterId: string) => boolean)\n\nexport interface StandardLogInstance<N extends string = LogMethodNames> {\n\t/**\n\t * The current log level.\n\t */\n\tlogLevel: number\n\t/**\n\t * Convert log level number to log level name.\n\t */\n\ttoLogLevelName(level: number): string\n\t/**\n\t * Convert log level name to log level number.\n\t */\n\ttoLogLevel(name: N): number\n\t/**\n\t * Get a logger instance with the specified id.\n\t *\n\t * ```ts\n\t * const logger = getLogger('my-logger')\n\t *\n\t * logger.info('Hello world!') // 2020-01-01T00:00:00.000Z my-logger (INFO) Hello world!\n\t * ```\n\t */\n\tgetLogger(id: string, options?: LoggerOptions): Logger<N | LogMethodNames>\n\t/**\n\t * Get a non-console logger instance with the specified id.\n\t *\n\t * The resulting logger will only send to the reporters that are not console reporters.\n\t *\n\t * ```ts\n\t * const logger = getNonConsoleLogger('my-logger')\n\t *\n\t * logger.info('Hello world!') // will not send to any console reporter\n\t * ```\n\t */\n\tgetNonConsoleLogger(id: string, options?: LoggerOptions): Logger<N | LogMethodNames>\n}\n\n/**\n * Formats a log entry.\n * Depends on the reporter, it can expect a different return type.\n * By default the return type is `any[]` which the `console` accepts.\n */\nexport type LogFormatter<T = any[]> = (entry: LogEntry) => T\n\n/**\n * Determines whether the entry should be written.\n */\nexport type LogFilter = (entry: LogEntry) => boolean\n\nexport type LogLevelEntry = { name: string; level: number }\n\nexport interface LogReporter<T = any> {\n\treadonly id: string\n\t/**\n\t * Specifies the formatter to be used by the reporter.\n\t * Using this you can customize how the reporter writes the log entry.\n\t */\n\treadonly formatter: LogFormatter<T>\n\t/**\n\t * Specifies a filter to determine should the log be written.\n\t */\n\treadonly filter?: LogFilter\n\t/**\n\t * Indicates if this is a console reporter.\n\t * There is only one console reporter can be present in the system.\n\t */\n\treadonly isConsoleReporter?: boolean\n\twrite(entry: LogEntry): void\n}\n\nexport type LogReporterOptions<T = any> = {\n\tid?: string\n\t/**\n\t * Specifies the formatter to be used by the reporter.\n\t * Using this you can customize how the reporter writes the log entry.\n\t */\n\tformatter?: LogFormatter<T>\n\t/**\n\t * Specifies a filter to determine should the log be written.\n\t */\n\tfilter?: LogFilter\n}\n\nexport type LogLevel = number\n\nexport interface ConsoleLike {\n\tdebug(...args: any[]): void\n\tinfo(...args: any[]): void\n\twarn(...args: any[]): void\n\terror(...args: any[]): void\n}\n"]}