standard-log 12.0.5 → 12.1.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 (48) hide show
  1. package/cjs/logger.js.map +1 -1
  2. package/cjs/memory.d.ts +1 -0
  3. package/cjs/memory.d.ts.map +1 -1
  4. package/cjs/memory.js +5 -0
  5. package/cjs/memory.js.map +1 -1
  6. package/cjs/{standard_log.mocks.d.ts → standard_log.testing.d.ts} +10 -2
  7. package/cjs/standard_log.testing.d.ts.map +1 -0
  8. package/cjs/{standard_log.mocks.js → standard_log.testing.js} +7 -1
  9. package/cjs/standard_log.testing.js.map +1 -0
  10. package/cjs/testing/index.d.ts +1 -1
  11. package/cjs/testing/index.d.ts.map +1 -1
  12. package/cjs/testing/index.js +2 -2
  13. package/cjs/testing/index.js.map +1 -1
  14. package/cjs/types.d.ts +2 -2
  15. package/cjs/types.js.map +1 -1
  16. package/dist/standard-log.es5.js +220 -215
  17. package/dist/standard-log.es5.js.gz +0 -0
  18. package/dist/standard-log.es5.js.map +1 -1
  19. package/dist/standard-log.es5.js.map.gz +0 -0
  20. package/dist/standard-log.esm.js +17 -12
  21. package/dist/standard-log.esm.js.gz +0 -0
  22. package/dist/standard-log.esm.js.map +1 -1
  23. package/dist/standard-log.esm.js.map.gz +0 -0
  24. package/esm/logger.js.map +1 -1
  25. package/esm/memory.d.ts +1 -0
  26. package/esm/memory.d.ts.map +1 -1
  27. package/esm/memory.js +5 -0
  28. package/esm/memory.js.map +1 -1
  29. package/esm/{standard_log.mocks.d.ts → standard_log.testing.d.ts} +10 -2
  30. package/esm/standard_log.testing.d.ts.map +1 -0
  31. package/esm/{standard_log.mocks.js → standard_log.testing.js} +7 -1
  32. package/esm/standard_log.testing.js.map +1 -0
  33. package/esm/testing/index.d.ts +1 -1
  34. package/esm/testing/index.d.ts.map +1 -1
  35. package/esm/testing/index.js +1 -1
  36. package/esm/testing/index.js.map +1 -1
  37. package/esm/types.d.ts +2 -2
  38. package/esm/types.js.map +1 -1
  39. package/package.json +3 -2
  40. package/ts/logger.ts +1 -1
  41. package/ts/memory.ts +6 -0
  42. package/ts/{standard_log.mocks.ts → standard_log.testing.ts} +18 -1
  43. package/ts/testing/index.ts +5 -1
  44. package/ts/types.ts +2 -2
  45. package/cjs/standard_log.mocks.d.ts.map +0 -1
  46. package/cjs/standard_log.mocks.js.map +0 -1
  47. package/esm/standard_log.mocks.d.ts.map +0 -1
  48. package/esm/standard_log.mocks.js.map +0 -1
package/esm/types.js.map CHANGED
@@ -1 +1 @@
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 = sl.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 = sl.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"]}
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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "standard-log",
3
- "version": "12.0.5",
3
+ "version": "12.1.1",
4
4
  "description": "The standard log library",
5
5
  "homepage": "https://github.com/unional/standard-log/tree/main/packages/log",
6
6
  "bugs": {
@@ -130,6 +130,7 @@
130
130
  "test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
131
131
  "test:watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch",
132
132
  "verify": "npm-run-all -p build depcheck lint coverage -p size",
133
- "watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch"
133
+ "watch": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --watch",
134
+ "w": "pnpm watch"
134
135
  }
135
136
  }
package/ts/logger.ts CHANGED
@@ -34,7 +34,7 @@ export function createLogger<N extends string = LogMethodNames>(
34
34
  writable: false,
35
35
  value: (
36
36
  counter =>
37
- (...args: any[]) => {
37
+ (...args: any[]): void => {
38
38
  if (shouldLog(store, logLevels.debug, logger.level))
39
39
  write({
40
40
  id,
package/ts/memory.ts CHANGED
@@ -13,6 +13,7 @@ export type MemoryLogReporter = LogReporter<LogEntry> & {
13
13
  getLogMessage(): string
14
14
  getLogMessages(): string[]
15
15
  getLogMessageWithLevel(): string
16
+ getLogMessagesWithLevel(): string[]
16
17
  getLogMessagesWithIdAndLevel(): string[]
17
18
  emit(): void
18
19
  }
@@ -58,6 +59,11 @@ function buildMemoryReporter(options?: LogReporterOptions<LogEntry>) {
58
59
  getLogMessages() {
59
60
  return logs.map(toInspectLogEntry).map(log => log.args.join(' '))
60
61
  },
62
+ getLogMessagesWithLevel() {
63
+ return logs
64
+ .map(toInspectLogEntry)
65
+ .map(log => `${formatLogLevel(log.level)} ${log.args.join(' ')}`)
66
+ },
61
67
  getLogMessagesWithIdAndLevel() {
62
68
  return logs
63
69
  .map(toInspectLogEntry)
@@ -1,17 +1,34 @@
1
+ import { createConsoleLogReporter } from './console.js'
1
2
  import { logLevels } from './log_levels.js'
2
3
  import { createMemoryLogReporter, type MemoryLogReporter } from './memory.js'
3
4
  import { createStandardLogClosure, type StandardLog } from './standard_log.js'
4
5
  import type { LogMethodNames, StandardLogOptions } from './types.js'
5
6
 
7
+ export type StandardLogForTestOptions<N extends string = LogMethodNames> = StandardLogOptions<N> & {
8
+ /**
9
+ * Send the logs to console to easy debugging.
10
+ *
11
+ * @default false
12
+ */
13
+ emitLog?: boolean
14
+ }
15
+
6
16
  export type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & {
7
17
  reporter: MemoryLogReporter
8
18
  }
9
19
 
10
20
  export function createStandardLogForTest<N extends string = LogMethodNames>(
11
- options: StandardLogOptions<N> = {}
21
+ options: StandardLogForTestOptions<N> = {}
12
22
  ): StandardLogForTest<N> {
13
23
  options.logLevel = options.logLevel ?? logLevels.debug
14
24
  options.reporters = options.reporters ?? []
25
+
26
+ if (options.emitLog && !options.reporters.some(r => r.isConsoleReporter)) {
27
+ // this is used for debugging,
28
+ // so no need to use color reporter.
29
+ options.reporters.push(createConsoleLogReporter())
30
+ }
31
+
15
32
  const existingReporter = options.reporters.find(r => r.id === 'memory') as MemoryLogReporter
16
33
  const reporter = existingReporter ?? createMemoryLogReporter()
17
34
  if (!existingReporter) {
@@ -1,2 +1,6 @@
1
1
  export { type MemoryLogReporter } from '../memory.js'
2
- export { createStandardLogForTest, type StandardLogForTest } from '../standard_log.mocks.js'
2
+ export {
3
+ createStandardLogForTest,
4
+ type StandardLogForTestOptions,
5
+ type StandardLogForTest
6
+ } from '../standard_log.testing.js'
package/ts/types.ts CHANGED
@@ -89,7 +89,7 @@ export interface StandardLogInstance<N extends string = LogMethodNames> {
89
89
  * Get a logger instance with the specified id.
90
90
  *
91
91
  * ```ts
92
- * const logger = sl.getLogger('my-logger')
92
+ * const logger = getLogger('my-logger')
93
93
  *
94
94
  * logger.info('Hello world!') // 2020-01-01T00:00:00.000Z my-logger (INFO) Hello world!
95
95
  * ```
@@ -101,7 +101,7 @@ export interface StandardLogInstance<N extends string = LogMethodNames> {
101
101
  * The resulting logger will only send to the reporters that are not console reporters.
102
102
  *
103
103
  * ```ts
104
- * const logger = sl.getNonConsoleLogger('my-logger')
104
+ * const logger = getNonConsoleLogger('my-logger')
105
105
  *
106
106
  * logger.info('Hello world!') // will not send to any console reporter
107
107
  * ```
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard_log.mocks.d.ts","sourceRoot":"","sources":["../ts/standard_log.mocks.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IACpF,QAAQ,EAAE,iBAAiB,CAAA;CAC3B,CAAA;AAED,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,EACzE,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM,GACjC,kBAAkB,CAAC,CAAC,CAAC,CAUvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard_log.mocks.js","sourceRoot":"","sources":["../ts/standard_log.mocks.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iDAA2C;AAC3C,yCAA6E;AAC7E,qDAA8E;AAO9E,SAAgB,wBAAwB,CACvC,OAAmC;;IAAnC,wBAAA,EAAA,YAAmC;IAEnC,OAAO,CAAC,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,yBAAS,CAAC,KAAK,CAAA;IACtD,OAAO,CAAC,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,EAAE,CAAA;IAC3C,IAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,UAAA,CAAC,IAAI,OAAA,CAAC,CAAC,EAAE,KAAK,QAAQ,EAAjB,CAAiB,CAAsB,CAAA;IAC5F,IAAM,QAAQ,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,IAAA,mCAAuB,GAAE,CAAA;IAC9D,IAAI,CAAC,gBAAgB,EAAE;QACtB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;KAChC;IACD,IAAM,OAAO,GAAG,IAAA,0CAAwB,EAAI,OAAO,CAAC,CAAA;IACpD,6BAAY,OAAO,CAAC,WAAW,KAAE,QAAQ,UAAA,IAAE;AAC5C,CAAC;AAZD,4DAYC","sourcesContent":["import { logLevels } from './log_levels.js'\nimport { createMemoryLogReporter, type MemoryLogReporter } from './memory.js'\nimport { createStandardLogClosure, type StandardLog } from './standard_log.js'\nimport type { LogMethodNames, StandardLogOptions } from './types.js'\n\nexport type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & {\n\treporter: MemoryLogReporter\n}\n\nexport function createStandardLogForTest<N extends string = LogMethodNames>(\n\toptions: StandardLogOptions<N> = {}\n): StandardLogForTest<N> {\n\toptions.logLevel = options.logLevel ?? logLevels.debug\n\toptions.reporters = options.reporters ?? []\n\tconst existingReporter = options.reporters.find(r => r.id === 'memory') as MemoryLogReporter\n\tconst reporter = existingReporter ?? createMemoryLogReporter()\n\tif (!existingReporter) {\n\t\toptions.reporters.push(reporter)\n\t}\n\tconst closure = createStandardLogClosure<N>(options)\n\treturn { ...closure.standardLog, reporter }\n}\n"]}
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard_log.mocks.d.ts","sourceRoot":"","sources":["../ts/standard_log.mocks.ts"],"names":[],"mappings":"AACA,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,EAA4B,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAEpE,MAAM,MAAM,kBAAkB,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG;IACpF,QAAQ,EAAE,iBAAiB,CAAA;CAC3B,CAAA;AAED,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,GAAG,cAAc,EACzE,OAAO,GAAE,kBAAkB,CAAC,CAAC,CAAM,GACjC,kBAAkB,CAAC,CAAC,CAAC,CAUvB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"standard_log.mocks.js","sourceRoot":"","sources":["../ts/standard_log.mocks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,uBAAuB,EAA0B,MAAM,aAAa,CAAA;AAC7E,OAAO,EAAE,wBAAwB,EAAoB,MAAM,mBAAmB,CAAA;AAO9E,MAAM,UAAU,wBAAwB,CACvC,UAAiC,EAAE;;IAEnC,OAAO,CAAC,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,SAAS,CAAC,KAAK,CAAA;IACtD,OAAO,CAAC,SAAS,GAAG,MAAA,OAAO,CAAC,SAAS,mCAAI,EAAE,CAAA;IAC3C,MAAM,gBAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,QAAQ,CAAsB,CAAA;IAC5F,MAAM,QAAQ,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,uBAAuB,EAAE,CAAA;IAC9D,IAAI,CAAC,gBAAgB,EAAE;QACtB,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;KAChC;IACD,MAAM,OAAO,GAAG,wBAAwB,CAAI,OAAO,CAAC,CAAA;IACpD,OAAO,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,QAAQ,EAAE,CAAA;AAC5C,CAAC","sourcesContent":["import { logLevels } from './log_levels.js'\nimport { createMemoryLogReporter, type MemoryLogReporter } from './memory.js'\nimport { createStandardLogClosure, type StandardLog } from './standard_log.js'\nimport type { LogMethodNames, StandardLogOptions } from './types.js'\n\nexport type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & {\n\treporter: MemoryLogReporter\n}\n\nexport function createStandardLogForTest<N extends string = LogMethodNames>(\n\toptions: StandardLogOptions<N> = {}\n): StandardLogForTest<N> {\n\toptions.logLevel = options.logLevel ?? logLevels.debug\n\toptions.reporters = options.reporters ?? []\n\tconst existingReporter = options.reporters.find(r => r.id === 'memory') as MemoryLogReporter\n\tconst reporter = existingReporter ?? createMemoryLogReporter()\n\tif (!existingReporter) {\n\t\toptions.reporters.push(reporter)\n\t}\n\tconst closure = createStandardLogClosure<N>(options)\n\treturn { ...closure.standardLog, reporter }\n}\n"]}