standard-log 13.3.0 → 13.3.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.
- package/cjs/console.d.ts +5 -6
- package/cjs/console.d.ts.map +1 -1
- package/cjs/console.js +2 -2
- package/cjs/console.js.map +1 -1
- package/cjs/errors.d.ts +2 -3
- package/cjs/errors.d.ts.map +1 -1
- package/cjs/formatter.d.ts +5 -6
- package/cjs/formatter.d.ts.map +1 -1
- package/cjs/log_levels.d.ts +4 -5
- package/cjs/log_levels.d.ts.map +1 -1
- package/cjs/log_store.d.ts +4 -5
- package/cjs/log_store.d.ts.map +1 -1
- package/cjs/log_store.js +1 -1
- package/cjs/log_store.js.map +1 -1
- package/cjs/logger.d.ts +1 -2
- package/cjs/logger.d.ts.map +1 -1
- package/cjs/memory.d.ts +5 -6
- package/cjs/memory.d.ts.map +1 -1
- package/cjs/memory.js +3 -2
- package/cjs/memory.js.map +1 -1
- package/cjs/platform.browser.d.ts +2 -3
- package/cjs/platform.browser.d.ts.map +1 -1
- package/cjs/platform.d.ts +2 -3
- package/cjs/platform.d.ts.map +1 -1
- package/cjs/platform.js +1 -1
- package/cjs/standard_log.ctx.d.ts +1 -2
- package/cjs/standard_log.ctx.d.ts.map +1 -1
- package/cjs/standard_log.d.ts +7 -8
- package/cjs/standard_log.d.ts.map +1 -1
- package/cjs/standard_log.testing.d.ts +3 -4
- package/cjs/standard_log.testing.d.ts.map +1 -1
- package/cjs/types.d.ts +16 -17
- package/cjs/types.d.ts.map +1 -1
- package/dist/standard-log.esm.js +104 -45
- package/dist/standard-log.esm.js.map +1 -1
- package/dist/standard-log.iife.js +104 -45
- package/dist/standard-log.iife.js.map +1 -1
- package/esm/console.d.ts +5 -6
- package/esm/console.d.ts.map +1 -1
- package/esm/console.js +1 -1
- package/esm/console.js.map +1 -1
- package/esm/errors.d.ts +2 -3
- package/esm/errors.d.ts.map +1 -1
- package/esm/formatter.d.ts +5 -6
- package/esm/formatter.d.ts.map +1 -1
- package/esm/log_levels.d.ts +4 -5
- package/esm/log_levels.d.ts.map +1 -1
- package/esm/log_store.d.ts +4 -5
- package/esm/log_store.d.ts.map +1 -1
- package/esm/log_store.js +2 -2
- package/esm/log_store.js.map +1 -1
- package/esm/logger.d.ts +1 -2
- package/esm/logger.d.ts.map +1 -1
- package/esm/memory.d.ts +5 -6
- package/esm/memory.d.ts.map +1 -1
- package/esm/memory.js +2 -1
- package/esm/memory.js.map +1 -1
- package/esm/platform.browser.d.ts +2 -3
- package/esm/platform.browser.d.ts.map +1 -1
- package/esm/platform.d.ts +2 -3
- package/esm/platform.d.ts.map +1 -1
- package/esm/platform.js +1 -1
- package/esm/standard_log.ctx.d.ts +1 -2
- package/esm/standard_log.ctx.d.ts.map +1 -1
- package/esm/standard_log.d.ts +7 -8
- package/esm/standard_log.d.ts.map +1 -1
- package/esm/standard_log.testing.d.ts +3 -4
- package/esm/standard_log.testing.d.ts.map +1 -1
- package/esm/types.d.ts +16 -17
- package/esm/types.d.ts.map +1 -1
- package/package.json +6 -5
- package/ts/console.ts +1 -1
- package/ts/log_store.ts +2 -2
- package/ts/memory.ts +2 -1
package/esm/platform.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"platform.d.ts","names":[],"sources":["../ts/platform.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"platform.d.ts","names":[],"sources":["../ts/platform.ts"],"mappings":";;qBAIa,oBAAiB,GAAO,aAAQ;qBAIhC;EAAY,UAAU"}
|
package/esm/platform.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { record } from "type-plus";
|
|
2
1
|
import { inspect } from "node:util";
|
|
2
|
+
import { record } from "type-plus";
|
|
3
3
|
//#region ts/platform.ts
|
|
4
4
|
const toInspectLogEntry = (e) => (e.args = e.args.map((value) => typeof value === "object" && value !== null ? inspect(value) : value), e);
|
|
5
5
|
const polyfill = record();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LogMethodNames, StandardLogInstance } from "./types.js";
|
|
2
2
|
import { LogStore } from "./log_store.js";
|
|
3
3
|
//#region ts/standard_log.ctx.d.ts
|
|
4
|
-
declare const ctx: {
|
|
4
|
+
export declare const ctx: {
|
|
5
5
|
configured?: boolean;
|
|
6
6
|
gsl?: {
|
|
7
7
|
store: LogStore;
|
|
@@ -9,5 +9,4 @@ declare const ctx: {
|
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
11
|
//#endregion
|
|
12
|
-
export { ctx };
|
|
13
12
|
//# sourceMappingURL=standard_log.ctx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard_log.ctx.d.ts","names":[],"sources":["../ts/standard_log.ctx.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"standard_log.ctx.d.ts","names":[],"sources":["../ts/standard_log.ctx.ts"],"mappings":";;;qBAIa;EACZ;EACA;IAAQ,OAAO;IAAU,aAAa,oBAAoB"}
|
package/esm/standard_log.d.ts
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
1
|
import { LogMethodNames, Logger, LoggerOptions, StandardLogInstance, StandardLogOptions } from "./types.js";
|
|
2
2
|
import { LogStore } from "./log_store.js";
|
|
3
3
|
//#region ts/standard_log.d.ts
|
|
4
|
-
interface StandardLog<N extends string = LogMethodNames> extends Readonly<StandardLogInstance<N>> {}
|
|
5
|
-
declare function createStandardLog<N extends string = LogMethodNames>(options?: StandardLogOptions<N>): StandardLog<N>;
|
|
6
|
-
declare function createStandardLogClosure<N extends string = LogMethodNames>(options?: StandardLogOptions<N>): {
|
|
4
|
+
export interface StandardLog<N extends string = LogMethodNames> extends Readonly<StandardLogInstance<N>> {}
|
|
5
|
+
export declare function createStandardLog<N extends string = LogMethodNames>(options?: StandardLogOptions<N>): StandardLog<N>;
|
|
6
|
+
export declare function createStandardLogClosure<N extends string = LogMethodNames>(options?: StandardLogOptions<N>): {
|
|
7
7
|
store: LogStore;
|
|
8
8
|
standardLog: StandardLog<N>;
|
|
9
9
|
};
|
|
10
10
|
/**
|
|
11
11
|
* Suppress logging within the code block.
|
|
12
12
|
*/
|
|
13
|
-
declare function suppressLogs<R>(block: () => R, log: Logger, ...logs: Logger[]): R;
|
|
14
|
-
type GetLogger<N extends string = LogMethodNames> = (id: string, options?: LoggerOptions) => Logger<LogMethodNames | N>;
|
|
15
|
-
declare function getLogger<N extends string = LogMethodNames>(id: string, options?: LoggerOptions): Logger<N | LogMethodNames>;
|
|
16
|
-
declare function configGlobal(options: Omit<StandardLogOptions, 'customLevels'>): void;
|
|
13
|
+
export declare function suppressLogs<R>(block: () => R, log: Logger, ...logs: Logger[]): R;
|
|
14
|
+
export type GetLogger<N extends string = LogMethodNames> = (id: string, options?: LoggerOptions) => Logger<LogMethodNames | N>;
|
|
15
|
+
export declare function getLogger<N extends string = LogMethodNames>(id: string, options?: LoggerOptions): Logger<N | LogMethodNames>;
|
|
16
|
+
export declare function configGlobal(options: Omit<StandardLogOptions, 'customLevels'>): void;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { GetLogger, StandardLog, configGlobal, createStandardLog, createStandardLogClosure, getLogger, suppressLogs };
|
|
19
18
|
//# sourceMappingURL=standard_log.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard_log.d.ts","names":[],"sources":["../ts/standard_log.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"standard_log.d.ts","names":[],"sources":["../ts/standard_log.ts"],"mappings":";;;iBAaiB,YAAY,mBAAmB,wBAAwB,SAAS,oBAAoB;wBAErF,kBAAkB,mBAAmB,gBACpD,UAAU,mBAAmB,KAC3B,YAAY;wBAeC,yBAAyB,mBAAmB,gBAC3D,UAAU,mBAAmB;EACzB,OAAO;EAAU,aAAa,YAAY;;;;;wBA4D/B,aAAa,GAAG,aAAa,GAAG,KAAK,WAAW,MAAM,WAAW;YASrE,UAAU,mBAAmB,mBACxC,YACA,UAAU,kBACN,OAAO,iBAAiB;wBAEb,UAAU,mBAAmB,gBAAgB,YAAY,UAAU,gBAAa,OAAA,IAAA;wBAUhF,aAAa,SAAS,KAAK"}
|
|
@@ -2,7 +2,7 @@ import { LogMethodNames, StandardLogOptions } from "./types.js";
|
|
|
2
2
|
import { MemoryLogReporter } from "./memory.js";
|
|
3
3
|
import { StandardLog } from "./standard_log.js";
|
|
4
4
|
//#region ts/standard_log.testing.d.ts
|
|
5
|
-
type StandardLogForTestOptions<N extends string = LogMethodNames> = StandardLogOptions<N> & {
|
|
5
|
+
export type StandardLogForTestOptions<N extends string = LogMethodNames> = StandardLogOptions<N> & {
|
|
6
6
|
/**
|
|
7
7
|
* Send the logs to console for easy debugging.
|
|
8
8
|
*
|
|
@@ -10,10 +10,9 @@ type StandardLogForTestOptions<N extends string = LogMethodNames> = StandardLogO
|
|
|
10
10
|
*/
|
|
11
11
|
emitLog?: boolean;
|
|
12
12
|
};
|
|
13
|
-
type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & {
|
|
13
|
+
export type StandardLogForTest<N extends string = LogMethodNames> = StandardLog<N> & {
|
|
14
14
|
reporter: MemoryLogReporter;
|
|
15
15
|
};
|
|
16
|
-
declare function createStandardLogForTest<N extends string = LogMethodNames>(options?: StandardLogForTestOptions<N>): StandardLogForTest<N>;
|
|
16
|
+
export declare function createStandardLogForTest<N extends string = LogMethodNames>(options?: StandardLogForTestOptions<N>): StandardLogForTest<N>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { StandardLogForTest, StandardLogForTestOptions, createStandardLogForTest };
|
|
19
18
|
//# sourceMappingURL=standard_log.testing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"standard_log.testing.d.ts","names":[],"sources":["../ts/standard_log.testing.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"standard_log.testing.d.ts","names":[],"sources":["../ts/standard_log.testing.ts"],"mappings":";;;;YAMY,0BAA0B,mBAAmB,kBAAkB,mBAAmB;;;;;;EAM7F;;YAGW,mBAAmB,mBAAmB,kBAAkB,YAAY;EAC/E,UAAU;;wBAGK,yBAAyB,mBAAmB,gBAC3D,UAAS,0BAA0B,KACjC,mBAAmB"}
|
package/esm/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StackTraceMeta } from "@just-func/types";
|
|
2
2
|
//#region ts/types.d.ts
|
|
3
|
-
type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {
|
|
3
|
+
export type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {
|
|
4
4
|
/**
|
|
5
5
|
* A map of custom log levels.
|
|
6
6
|
*
|
|
@@ -19,11 +19,11 @@ type StandardLogOptions<CustomLevelNames extends string = LogMethodNames> = {
|
|
|
19
19
|
logLevel?: number;
|
|
20
20
|
reporters?: LogReporter[];
|
|
21
21
|
};
|
|
22
|
-
interface LoggerOptions extends StackTraceMeta {
|
|
22
|
+
export interface LoggerOptions extends StackTraceMeta {
|
|
23
23
|
level?: number;
|
|
24
24
|
writeTo?: LogReporter | ReporterFilter;
|
|
25
25
|
}
|
|
26
|
-
type Logger<N extends string = LogMethodNames> = {
|
|
26
|
+
export type Logger<N extends string = LogMethodNames> = {
|
|
27
27
|
readonly id: string;
|
|
28
28
|
/**
|
|
29
29
|
* Logger local log level.
|
|
@@ -43,17 +43,17 @@ type Logger<N extends string = LogMethodNames> = {
|
|
|
43
43
|
/**
|
|
44
44
|
* Names of the standard log methods.
|
|
45
45
|
*/
|
|
46
|
-
type LogMethodNames = 'emergency' | 'alert' | 'critical' | 'error' | 'warn' | 'notice' | 'info' | 'debug' | 'trace' | 'planck';
|
|
47
|
-
type LogEntry = {
|
|
46
|
+
export type LogMethodNames = 'emergency' | 'alert' | 'critical' | 'error' | 'warn' | 'notice' | 'info' | 'debug' | 'trace' | 'planck';
|
|
47
|
+
export type LogEntry = {
|
|
48
48
|
id: string;
|
|
49
49
|
level: number;
|
|
50
50
|
args: any[];
|
|
51
51
|
timestamp: Date;
|
|
52
52
|
};
|
|
53
|
-
type LogMethod = (...args: any[]) => void;
|
|
54
|
-
type LogFunction = (log: LogMethod, logLevel: number) => string | undefined | void;
|
|
55
|
-
type ReporterFilter = string | RegExp | ((reporterId: string) => boolean);
|
|
56
|
-
interface StandardLogInstance<N extends string = LogMethodNames> {
|
|
53
|
+
export type LogMethod = (...args: any[]) => void;
|
|
54
|
+
export type LogFunction = (log: LogMethod, logLevel: number) => string | undefined | void;
|
|
55
|
+
export type ReporterFilter = string | RegExp | ((reporterId: string) => boolean);
|
|
56
|
+
export interface StandardLogInstance<N extends string = LogMethodNames> {
|
|
57
57
|
/**
|
|
58
58
|
* The current log level.
|
|
59
59
|
*/
|
|
@@ -94,16 +94,16 @@ interface StandardLogInstance<N extends string = LogMethodNames> {
|
|
|
94
94
|
* Depends on the reporter, it can expect a different return type.
|
|
95
95
|
* By default the return type is `any[]` which the `console` accepts.
|
|
96
96
|
*/
|
|
97
|
-
type LogFormatter<T = any[]> = (entry: LogEntry) => T;
|
|
97
|
+
export type LogFormatter<T = any[]> = (entry: LogEntry) => T;
|
|
98
98
|
/**
|
|
99
99
|
* Determines whether the entry should be written.
|
|
100
100
|
*/
|
|
101
|
-
type LogFilter = (entry: LogEntry) => boolean;
|
|
102
|
-
type LogLevelEntry = {
|
|
101
|
+
export type LogFilter = (entry: LogEntry) => boolean;
|
|
102
|
+
export type LogLevelEntry = {
|
|
103
103
|
name: string;
|
|
104
104
|
level: number;
|
|
105
105
|
};
|
|
106
|
-
interface LogReporter<T = any> {
|
|
106
|
+
export interface LogReporter<T = any> {
|
|
107
107
|
readonly id: string;
|
|
108
108
|
/**
|
|
109
109
|
* Specifies the formatter to be used by the reporter.
|
|
@@ -121,7 +121,7 @@ interface LogReporter<T = any> {
|
|
|
121
121
|
readonly isConsoleReporter?: boolean;
|
|
122
122
|
write(entry: LogEntry): void;
|
|
123
123
|
}
|
|
124
|
-
type LogReporterOptions<T = any> = {
|
|
124
|
+
export type LogReporterOptions<T = any> = {
|
|
125
125
|
id?: string;
|
|
126
126
|
/**
|
|
127
127
|
* Specifies the formatter to be used by the reporter.
|
|
@@ -133,13 +133,12 @@ type LogReporterOptions<T = any> = {
|
|
|
133
133
|
*/
|
|
134
134
|
filter?: LogFilter;
|
|
135
135
|
};
|
|
136
|
-
type LogLevel = number;
|
|
137
|
-
interface ConsoleLike {
|
|
136
|
+
export type LogLevel = number;
|
|
137
|
+
export interface ConsoleLike {
|
|
138
138
|
debug(...args: any[]): void;
|
|
139
139
|
info(...args: any[]): void;
|
|
140
140
|
warn(...args: any[]): void;
|
|
141
141
|
error(...args: any[]): void;
|
|
142
142
|
}
|
|
143
143
|
//#endregion
|
|
144
|
-
export { ConsoleLike, LogEntry, LogFilter, LogFormatter, LogFunction, LogLevel, LogLevelEntry, LogMethod, LogMethodNames, LogReporter, LogReporterOptions, Logger, LoggerOptions, ReporterFilter, StandardLogInstance, StandardLogOptions };
|
|
145
144
|
//# sourceMappingURL=types.d.ts.map
|
package/esm/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","names":[],"sources":["../ts/types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"types.d.ts","names":[],"sources":["../ts/types.ts"],"mappings":";;YAEY,mBAAmB,kCAAkC;;;;;;;;;;;;;;;EAehE,eAAe,OAAO;EACtB;EACA,YAAY;;iBAGI,sBAAsB;EACtC;EACA,UAAU,cAAc;;YAGb,OAAO,mBAAmB;WAC5B;;;;EAIT;;;;;EAKA,SAAS;EACT,GAAG,gBAAgB,GAAG,aAAa;;;;EAInC,MAAM,OAAO;OACP,KAAK,IAAI;;;;YAKJ;YAYA;EACX;EACA;EAEA;EACA,WAAW;;YAGA,gBAAgB;YAEhB,eAAe,KAAK,WAAW;YAE/B,0BAA0B,WAAW;iBAEhC,oBAAoB,mBAAmB;;;;EAIvD;;;;EAIA,eAAe;;;;EAIf,WAAW,MAAM;;;;;;;;;;EAUjB,UAAU,YAAY,UAAU,gBAAgB,OAAO,IAAI;;;;;;;;;;;;EAY3D,oBAAoB,YAAY,UAAU,gBAAgB,OAAO,IAAI;;;;;;;YAQ1D,aAAa,cAAc,OAAO,aAAa;;;;YAK/C,aAAa,OAAO;YAEpB;EAAkB;EAAc;;iBAE3B,YAAY;WACnB;;;;;WAKA,WAAW,aAAa;;;;WAIxB,SAAS;;;;;WAKT;EACT,MAAM,OAAO;;YAGF,mBAAmB;EAC9B;;;;;EAKA,YAAY,aAAa;;;;EAIzB,SAAS;;YAGE;iBAEK;EAChB,SAAS;EACT,QAAQ;EACR,QAAQ;EACR,SAAS"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "standard-log",
|
|
3
|
-
"version": "13.3.
|
|
3
|
+
"version": "13.3.1",
|
|
4
4
|
"description": "The standard log library",
|
|
5
5
|
"homepage": "https://github.com/cyberuni/standard-log/tree/main/packages/log",
|
|
6
6
|
"bugs": {
|
|
@@ -58,13 +58,14 @@
|
|
|
58
58
|
"!**/test_utils.*"
|
|
59
59
|
],
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@just-func/types": "^0.6.
|
|
61
|
+
"@just-func/types": "^0.6.1",
|
|
62
62
|
"iso-error": "^7.0.0",
|
|
63
63
|
"ms": "^2.1.3",
|
|
64
|
-
"type-plus": "8.0.0-beta.
|
|
64
|
+
"type-plus": "8.0.0-beta.12",
|
|
65
|
+
"unpartial": "^1.0.8"
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
67
|
-
"@repobuddy/vitest": "^2.
|
|
68
|
+
"@repobuddy/vitest": "^2.3.0",
|
|
68
69
|
"@types/ms": "^2.0.0",
|
|
69
70
|
"@types/node": "^24.0.0",
|
|
70
71
|
"@types/ramda": "^0.32.0",
|
|
@@ -73,7 +74,7 @@
|
|
|
73
74
|
"dirname-filename-esm": "^1.1.1",
|
|
74
75
|
"ramda": "^0.32.0",
|
|
75
76
|
"rimraf": "^6.0.0",
|
|
76
|
-
"tsdown": "^0.
|
|
77
|
+
"tsdown": "^0.23.0",
|
|
77
78
|
"typescript": "^7.0.2",
|
|
78
79
|
"vitest": "^4.1.0"
|
|
79
80
|
},
|
package/ts/console.ts
CHANGED
package/ts/log_store.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mapKey, record, reduceByKey
|
|
1
|
+
import { mapKey, record, reduceByKey } from 'type-plus'
|
|
2
2
|
import { createConsoleLogReporter } from './console.js'
|
|
3
3
|
import { logLevels, toLogLevel, toLogLevelName } from './log_levels.js'
|
|
4
4
|
import type { Logger, LogLevel, LogMethodNames, LogReporter, StandardLogOptions } from './types.js'
|
|
@@ -49,7 +49,7 @@ export function logLevelStore(options: LogLevelStoreOptions) {
|
|
|
49
49
|
return store.customLevels[name] ?? toLogLevel(name)
|
|
50
50
|
},
|
|
51
51
|
getAllLevels() {
|
|
52
|
-
return
|
|
52
|
+
return reduceByKey(
|
|
53
53
|
logLevels,
|
|
54
54
|
(result, name) => {
|
|
55
55
|
if (name !== 'none' && name !== 'all') result.push({ name, level: logLevels[name] })
|
package/ts/memory.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { required
|
|
1
|
+
import { required } from 'type-plus'
|
|
2
|
+
import { unpartial } from 'unpartial'
|
|
2
3
|
import { createConsoleLogReporter } from './console.js'
|
|
3
4
|
import { formatLogLevel } from './formatter.js'
|
|
4
5
|
import { toInspectLogEntry } from './platform.js'
|