standard-log 13.3.1 → 13.3.3
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/CHANGELOG.md +989 -0
- package/cjs/log_store.d.ts.map +1 -1
- package/cjs/log_store.js +7 -7
- package/cjs/log_store.js.map +1 -1
- package/cjs/memory.d.ts.map +1 -1
- package/cjs/memory.js +1 -2
- package/cjs/memory.js.map +1 -1
- package/cjs/platform.browser.js +2 -2
- package/cjs/platform.browser.js.map +1 -1
- package/cjs/platform.js +2 -2
- package/cjs/platform.js.map +1 -1
- package/cjs/record.d.ts +9 -0
- package/cjs/record.d.ts.map +1 -0
- package/cjs/record.js +15 -0
- package/cjs/record.js.map +1 -0
- package/cjs/standard_log.ctx.js +1 -1
- package/cjs/standard_log.ctx.js.map +1 -1
- package/cjs/standard_log.d.ts.map +1 -1
- package/cjs/standard_log.js +4 -3
- package/cjs/standard_log.js.map +1 -1
- package/cjs/types.d.ts +5 -2
- package/cjs/types.d.ts.map +1 -1
- package/dist/standard-log.esm.js +22 -97
- package/dist/standard-log.esm.js.map +1 -1
- package/dist/standard-log.iife.js +22 -97
- package/dist/standard-log.iife.js.map +1 -1
- package/esm/log_store.d.ts.map +1 -1
- package/esm/log_store.js +4 -4
- package/esm/log_store.js.map +1 -1
- package/esm/memory.d.ts.map +1 -1
- package/esm/memory.js +1 -2
- package/esm/memory.js.map +1 -1
- package/esm/platform.browser.js +1 -1
- package/esm/platform.browser.js.map +1 -1
- package/esm/platform.js +1 -1
- package/esm/platform.js.map +1 -1
- package/esm/record.d.ts +9 -0
- package/esm/record.d.ts.map +1 -0
- package/esm/record.js +14 -0
- package/esm/record.js.map +1 -0
- package/esm/standard_log.ctx.js +1 -1
- package/esm/standard_log.ctx.js.map +1 -1
- package/esm/standard_log.d.ts.map +1 -1
- package/esm/standard_log.js +2 -1
- package/esm/standard_log.js.map +1 -1
- package/esm/types.d.ts +5 -2
- package/esm/types.d.ts.map +1 -1
- package/package.json +7 -7
- package/ts/log_store.ts +4 -6
- package/ts/memory.ts +1 -2
- package/ts/platform.browser.ts +1 -1
- package/ts/platform.ts +1 -1
- package/ts/record.ts +9 -0
- package/ts/standard_log.ctx.ts +1 -1
- package/ts/standard_log.ts +2 -1
- package/ts/types.ts +5 -3
package/ts/log_store.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { mapKey, record, reduceByKey } from 'type-plus'
|
|
2
1
|
import { createConsoleLogReporter } from './console.js'
|
|
3
2
|
import { logLevels, toLogLevel, toLogLevelName } from './log_levels.js'
|
|
3
|
+
import { record } from './record.js'
|
|
4
4
|
import type { Logger, LogLevel, LogMethodNames, LogReporter, StandardLogOptions } from './types.js'
|
|
5
5
|
|
|
6
6
|
export function createLogStore<N extends string = LogMethodNames>(
|
|
@@ -32,8 +32,7 @@ export function logLevelStore(options: LogLevelStoreOptions) {
|
|
|
32
32
|
|
|
33
33
|
const store = {
|
|
34
34
|
customLevels,
|
|
35
|
-
customLevelsReverse:
|
|
36
|
-
customLevels,
|
|
35
|
+
customLevelsReverse: Object.keys(customLevels).reduce(
|
|
37
36
|
(p, k) => {
|
|
38
37
|
p[customLevels[k]] = k
|
|
39
38
|
return p
|
|
@@ -49,14 +48,13 @@ export function logLevelStore(options: LogLevelStoreOptions) {
|
|
|
49
48
|
return store.customLevels[name] ?? toLogLevel(name)
|
|
50
49
|
},
|
|
51
50
|
getAllLevels() {
|
|
52
|
-
return
|
|
53
|
-
logLevels,
|
|
51
|
+
return (Object.keys(logLevels) as Array<keyof typeof logLevels>).reduce(
|
|
54
52
|
(result, name) => {
|
|
55
53
|
if (name !== 'none' && name !== 'all') result.push({ name, level: logLevels[name] })
|
|
56
54
|
|
|
57
55
|
return result
|
|
58
56
|
},
|
|
59
|
-
|
|
57
|
+
Object.keys(store.customLevels).map(name => ({ name, level: store.customLevels[name] }))
|
|
60
58
|
)
|
|
61
59
|
}
|
|
62
60
|
}
|
package/ts/memory.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { required } from '
|
|
2
|
-
import { unpartial } from 'unpartial'
|
|
1
|
+
import { required, unpartial } from 'unpartial'
|
|
3
2
|
import { createConsoleLogReporter } from './console.js'
|
|
4
3
|
import { formatLogLevel } from './formatter.js'
|
|
5
4
|
import { toInspectLogEntry } from './platform.js'
|
package/ts/platform.browser.ts
CHANGED
package/ts/platform.ts
CHANGED
package/ts/record.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a prototype-less object, optionally seeded with `value`.
|
|
3
|
+
*
|
|
4
|
+
* Inlined from `type-plus` so the CJS build does not `require()` the ESM-only `type-plus`.
|
|
5
|
+
*/
|
|
6
|
+
export function record<R extends Record<any, any>>(value?: R): R {
|
|
7
|
+
const r = Object.create(null)
|
|
8
|
+
return value ? Object.assign(r, value) : r
|
|
9
|
+
}
|
package/ts/standard_log.ctx.ts
CHANGED
package/ts/standard_log.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { required } from 'unpartial'
|
|
2
2
|
import { DEFAULT_LOG_METHOD_NAMES, logLevels } from './log_levels.js'
|
|
3
3
|
import { createLogStore, type LogStore } from './log_store.js'
|
|
4
4
|
import { createLogger } from './logger.js'
|
|
5
|
+
import { record } from './record.js'
|
|
5
6
|
import { ctx } from './standard_log.ctx.js'
|
|
6
7
|
import type {
|
|
7
8
|
Logger,
|
package/ts/types.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type { StackTraceMeta } from '@just-func/types'
|
|
2
|
-
|
|
3
1
|
export type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {
|
|
4
2
|
/**
|
|
5
3
|
* A map of custom log levels.
|
|
@@ -20,7 +18,11 @@ export type StandardLogOptions<CustomLevelNames extends string = LogMethodNames>
|
|
|
20
18
|
reporters?: LogReporter[]
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
export interface LoggerOptions
|
|
21
|
+
export interface LoggerOptions {
|
|
22
|
+
/**
|
|
23
|
+
* Stack start function: the stack trace is adjusted to start from this function.
|
|
24
|
+
*/
|
|
25
|
+
ssf?: (...args: any[]) => any
|
|
24
26
|
level?: number
|
|
25
27
|
writeTo?: LogReporter | ReporterFilter
|
|
26
28
|
}
|