@celljs/logger 3.8.0 → 3.9.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/esm/node/index.d.ts +2 -0
- package/esm/node/index.js +3 -0
- package/esm/node/index.js.map +1 -0
- package/esm/node/module.d.ts +3 -0
- package/esm/node/module.js +4 -0
- package/esm/node/module.js.map +1 -0
- package/esm/node/winston-logger-protocol.d.ts +7 -0
- package/esm/node/winston-logger-protocol.js +3 -0
- package/esm/node/winston-logger-protocol.js.map +1 -0
- package/esm/node/winston-logger.d.ts +15 -0
- package/esm/node/winston-logger.js +76 -0
- package/esm/node/winston-logger.js.map +1 -0
- package/esm/package.json +3 -0
- package/package.json +29 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/node/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../src/node/module.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,eAAe,QAAQ,EAAE,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Logger, LoggerOptions } from 'winston';
|
|
2
|
+
export declare const RawWinstonLogger: unique symbol;
|
|
3
|
+
export declare const WinstonConfig: unique symbol;
|
|
4
|
+
export interface WinstonConfig extends LoggerOptions {
|
|
5
|
+
}
|
|
6
|
+
export interface RawWinstonLogger extends Logger {
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"winston-logger-protocol.js","sourceRoot":"","sources":["../../src/node/winston-logger-protocol.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC;AAExD,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AbstractLogger } from '@celljs/core';
|
|
2
|
+
import { WinstonConfig, RawWinstonLogger } from './winston-logger-protocol.js';
|
|
3
|
+
export declare class WinstonLogger extends AbstractLogger {
|
|
4
|
+
protected readonly winstonConfig?: WinstonConfig;
|
|
5
|
+
protected readonly winstonConfig2?: WinstonConfig;
|
|
6
|
+
protected logger: RawWinstonLogger;
|
|
7
|
+
protected init(): void;
|
|
8
|
+
getLogger(): RawWinstonLogger;
|
|
9
|
+
error(message: string, context?: string): void;
|
|
10
|
+
warn(message: string, context?: string): void;
|
|
11
|
+
info(message: string, context?: string): void;
|
|
12
|
+
debug(message: string, context?: string): void;
|
|
13
|
+
protected resolvePrefix(context?: string): string;
|
|
14
|
+
protected log(message: any, context?: string, logFn?: (...args: any[]) => void): void;
|
|
15
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { Logger, LOGGER_CONFIG, Value, Component, Autowired, Optional, AbstractLogger, PostConstruct, Scope } from '@celljs/core';
|
|
11
|
+
import { WinstonConfig, RawWinstonLogger } from './winston-logger-protocol.js';
|
|
12
|
+
import { createLogger, transports, format } from 'winston';
|
|
13
|
+
let _logger;
|
|
14
|
+
let WinstonLogger = class WinstonLogger extends AbstractLogger {
|
|
15
|
+
init() {
|
|
16
|
+
if (!this.logger) {
|
|
17
|
+
if (_logger) {
|
|
18
|
+
this.logger = _logger;
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
_logger = createLogger({
|
|
22
|
+
level: this.level,
|
|
23
|
+
format: format.combine(format.timestamp(), format.printf(({ level, message, timestamp }) => `${timestamp} [${level}] ${message}`)),
|
|
24
|
+
transports: [new transports.Console()],
|
|
25
|
+
...this.winstonConfig,
|
|
26
|
+
...this.winstonConfig2,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
getLogger() {
|
|
31
|
+
return this.logger;
|
|
32
|
+
}
|
|
33
|
+
error(message, context) {
|
|
34
|
+
this.log(message, context, this.logger.error.bind(this.logger));
|
|
35
|
+
}
|
|
36
|
+
warn(message, context) {
|
|
37
|
+
this.log(message, context, this.logger.warn.bind(this.logger));
|
|
38
|
+
}
|
|
39
|
+
info(message, context) {
|
|
40
|
+
this.log(message, context, this.logger.info.bind(this.logger));
|
|
41
|
+
}
|
|
42
|
+
debug(message, context) {
|
|
43
|
+
this.log(message, context, this.logger.debug.bind(this.logger));
|
|
44
|
+
}
|
|
45
|
+
resolvePrefix(context) {
|
|
46
|
+
return '';
|
|
47
|
+
}
|
|
48
|
+
log(message, context, logFn) {
|
|
49
|
+
super.log(message, context, logFn !== null && logFn !== void 0 ? logFn : this.logger.info.bind(this.logger));
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
__decorate([
|
|
53
|
+
Value(`${LOGGER_CONFIG}.winstonConfig`),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], WinstonLogger.prototype, "winstonConfig", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
Autowired(WinstonConfig),
|
|
58
|
+
Optional(),
|
|
59
|
+
__metadata("design:type", Object)
|
|
60
|
+
], WinstonLogger.prototype, "winstonConfig2", void 0);
|
|
61
|
+
__decorate([
|
|
62
|
+
Autowired(RawWinstonLogger),
|
|
63
|
+
Optional(),
|
|
64
|
+
__metadata("design:type", Object)
|
|
65
|
+
], WinstonLogger.prototype, "logger", void 0);
|
|
66
|
+
__decorate([
|
|
67
|
+
PostConstruct(),
|
|
68
|
+
__metadata("design:type", Function),
|
|
69
|
+
__metadata("design:paramtypes", []),
|
|
70
|
+
__metadata("design:returntype", void 0)
|
|
71
|
+
], WinstonLogger.prototype, "init", null);
|
|
72
|
+
WinstonLogger = __decorate([
|
|
73
|
+
Component({ id: Logger, rebind: true, scope: Scope.Transient })
|
|
74
|
+
], WinstonLogger);
|
|
75
|
+
export { WinstonLogger };
|
|
76
|
+
//# sourceMappingURL=winston-logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"winston-logger.js","sourceRoot":"","sources":["../../src/node/winston-logger.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAClI,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC5E,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAE3D,IAAI,OAAyB,CAAC;AAGvB,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,cAAc;IAcnC,IAAI;QACV,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACf,IAAI,OAAO,EAAE,CAAC;gBACV,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC;gBACtB,OAAO;YACX,CAAC;YACD,OAAO,GAAG,YAAY,CAAC;gBACnB,KAAK,EAAE,IAAI,CAA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EAAE,CAAC;IACd,CAAC;IAEkB,GAAG,CAAC,OAAY,EAAE,OAAgB,EAAE,KAAgC;QACnF,KAAK,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7E,CAAC;CACJ,CAAA;AAzDsB;IADlB,KAAK,CAAC,GAAG,aAAa,gBAAgB,CAAC;;oDACS;AAI9B;IAFlB,SAAS,CAAC,aAAa,CAAC;IACxB,QAAQ,EAAE;;qDACuC;AAIxC;IAFT,SAAS,CAAC,gBAAgB,CAAC;IAC3B,QAAQ,EAAE;;6CACwB;AAGzB;IADT,aAAa,EAAE;;;;yCAkBf;AA/BQ,aAAa;IADzB,SAAS,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;GACnD,aAAa,CA4DzB"}
|
package/esm/package.json
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/logger",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.0",
|
|
4
4
|
"description": "logger component for pino",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -18,21 +18,46 @@
|
|
|
18
18
|
"typings": "lib/node/index.d.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"lib",
|
|
21
|
+
"esm",
|
|
21
22
|
"src",
|
|
22
23
|
"cell.yml"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
|
-
"build": "tsc -b",
|
|
26
|
-
"clean": "rm -rf lib *.tsbuildinfo",
|
|
26
|
+
"build": "tsc -b && bun ../../scripts/build-esm.ts",
|
|
27
|
+
"clean": "rm -rf lib esm *.tsbuildinfo",
|
|
27
28
|
"test": "bun test --preload reflect-metadata ./lib",
|
|
28
29
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
|
-
"@celljs/core": "3.
|
|
32
|
+
"@celljs/core": "3.9.0",
|
|
32
33
|
"tslib": "^2.8.0",
|
|
33
34
|
"winston": "^3.10.0"
|
|
34
35
|
},
|
|
35
36
|
"publishConfig": {
|
|
36
37
|
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"webpack": "./lib/node/index.js",
|
|
42
|
+
"import": "./esm/node/index.js",
|
|
43
|
+
"default": "./lib/node/index.js"
|
|
44
|
+
},
|
|
45
|
+
"./package.json": "./package.json",
|
|
46
|
+
"./lib/node": {
|
|
47
|
+
"webpack": "./lib/node/index.js",
|
|
48
|
+
"import": "./esm/node/index.js",
|
|
49
|
+
"default": "./lib/node/index.js"
|
|
50
|
+
},
|
|
51
|
+
"./lib/*.js": {
|
|
52
|
+
"webpack": "./lib/*.js",
|
|
53
|
+
"import": "./esm/*.js",
|
|
54
|
+
"default": "./lib/*.js"
|
|
55
|
+
},
|
|
56
|
+
"./lib/*": {
|
|
57
|
+
"webpack": "./lib/*.js",
|
|
58
|
+
"import": "./esm/*.js",
|
|
59
|
+
"default": "./lib/*.js"
|
|
60
|
+
},
|
|
61
|
+
"./*": "./*"
|
|
37
62
|
}
|
|
38
63
|
}
|