@onivoro/server-pino 22.0.0 → 22.0.2
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/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +1 -0
- package/dist/cjs/lib/functions/patch-console.function.d.ts +5 -0
- package/dist/cjs/lib/functions/patch-console.function.js +43 -0
- package/dist/cjs/lib/server-pino.module.d.ts +1 -1
- package/dist/cjs/lib/server-pino.module.js +8 -1
- package/dist/esm/index.d.ts +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/lib/functions/patch-console.function.d.ts +5 -0
- package/dist/esm/lib/functions/patch-console.function.js +43 -0
- package/dist/esm/lib/server-pino.module.d.ts +1 -1
- package/dist/esm/lib/server-pino.module.js +8 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/lib/functions/patch-console.function.d.ts +5 -0
- package/dist/types/lib/server-pino.module.d.ts +1 -1
- package/package.json +2 -2
package/dist/cjs/index.d.ts
CHANGED
package/dist/cjs/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./lib/classes/server-pino-config.class"), exports);
|
|
18
|
+
__exportStar(require("./lib/functions/patch-console.function"), exports);
|
|
18
19
|
__exportStar(require("./lib/server-pino.module"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.patchConsole = patchConsole;
|
|
4
|
+
function patchConsole(logger) {
|
|
5
|
+
const _console = logger;
|
|
6
|
+
const original = {
|
|
7
|
+
debug: console.debug,
|
|
8
|
+
error: console.error,
|
|
9
|
+
info: console.info,
|
|
10
|
+
log: console.log,
|
|
11
|
+
trace: console.trace,
|
|
12
|
+
warn: console.warn,
|
|
13
|
+
};
|
|
14
|
+
console.debug = (...args) => {
|
|
15
|
+
_console.debug(args);
|
|
16
|
+
};
|
|
17
|
+
console.error = (...args) => {
|
|
18
|
+
_console.error(args);
|
|
19
|
+
};
|
|
20
|
+
console.info = (...args) => {
|
|
21
|
+
_console.info(args);
|
|
22
|
+
};
|
|
23
|
+
console.log = (...args) => {
|
|
24
|
+
_console.info(args); // what should this be? which is higher level?
|
|
25
|
+
};
|
|
26
|
+
console.trace = (...args) => {
|
|
27
|
+
_console.trace(args);
|
|
28
|
+
};
|
|
29
|
+
console.warn = (...args) => {
|
|
30
|
+
_console.warn(args);
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
_console,
|
|
34
|
+
restore: () => {
|
|
35
|
+
Object.entries(original).forEach(([method, implementation]) => {
|
|
36
|
+
console[method] = implementation;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function segment(...args) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
@@ -9,14 +9,21 @@ var ServerPinoModule_1;
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ServerPinoModule = void 0;
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
|
+
const nestjs_pino_1 = require("nestjs-pino");
|
|
12
13
|
const server_pino_config_class_1 = require("./classes/server-pino-config.class");
|
|
13
14
|
const server_common_1 = require("@onivoro/server-common");
|
|
15
|
+
const patch_console_function_1 = require("./functions/patch-console.function");
|
|
14
16
|
let ServerPinoModule = ServerPinoModule_1 = class ServerPinoModule {
|
|
15
|
-
static configure(config) {
|
|
17
|
+
static configure(config, patchConsoleInstance = false) {
|
|
18
|
+
if (patchConsoleInstance) {
|
|
19
|
+
(0, patch_console_function_1.patchConsole)(new nestjs_pino_1.PinoLogger(config));
|
|
20
|
+
}
|
|
16
21
|
return (0, server_common_1.moduleFactory)({
|
|
17
22
|
module: ServerPinoModule_1,
|
|
23
|
+
imports: [nestjs_pino_1.LoggerModule.forRoot(config)],
|
|
18
24
|
providers: [
|
|
19
25
|
{ provide: server_pino_config_class_1.ServerPinoConfig, useValue: config },
|
|
26
|
+
// { provide: Logger, useFactory: (logger: PinoLogger) => logger, inject: [PinoLogger] }
|
|
20
27
|
]
|
|
21
28
|
});
|
|
22
29
|
}
|
package/dist/esm/index.d.ts
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./lib/classes/server-pino-config.class"), exports);
|
|
18
|
+
__exportStar(require("./lib/functions/patch-console.function"), exports);
|
|
18
19
|
__exportStar(require("./lib/server-pino.module"), exports);
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.patchConsole = patchConsole;
|
|
4
|
+
function patchConsole(logger) {
|
|
5
|
+
const _console = logger;
|
|
6
|
+
const original = {
|
|
7
|
+
debug: console.debug,
|
|
8
|
+
error: console.error,
|
|
9
|
+
info: console.info,
|
|
10
|
+
log: console.log,
|
|
11
|
+
trace: console.trace,
|
|
12
|
+
warn: console.warn,
|
|
13
|
+
};
|
|
14
|
+
console.debug = (...args) => {
|
|
15
|
+
_console.debug(args);
|
|
16
|
+
};
|
|
17
|
+
console.error = (...args) => {
|
|
18
|
+
_console.error(args);
|
|
19
|
+
};
|
|
20
|
+
console.info = (...args) => {
|
|
21
|
+
_console.info(args);
|
|
22
|
+
};
|
|
23
|
+
console.log = (...args) => {
|
|
24
|
+
_console.info(args); // what should this be? which is higher level?
|
|
25
|
+
};
|
|
26
|
+
console.trace = (...args) => {
|
|
27
|
+
_console.trace(args);
|
|
28
|
+
};
|
|
29
|
+
console.warn = (...args) => {
|
|
30
|
+
_console.warn(args);
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
_console,
|
|
34
|
+
restore: () => {
|
|
35
|
+
Object.entries(original).forEach(([method, implementation]) => {
|
|
36
|
+
console[method] = implementation;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function segment(...args) {
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
@@ -9,14 +9,21 @@ var ServerPinoModule_1;
|
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
10
|
exports.ServerPinoModule = void 0;
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
|
+
const nestjs_pino_1 = require("nestjs-pino");
|
|
12
13
|
const server_pino_config_class_1 = require("./classes/server-pino-config.class");
|
|
13
14
|
const server_common_1 = require("@onivoro/server-common");
|
|
15
|
+
const patch_console_function_1 = require("./functions/patch-console.function");
|
|
14
16
|
let ServerPinoModule = ServerPinoModule_1 = class ServerPinoModule {
|
|
15
|
-
static configure(config) {
|
|
17
|
+
static configure(config, patchConsoleInstance = false) {
|
|
18
|
+
if (patchConsoleInstance) {
|
|
19
|
+
(0, patch_console_function_1.patchConsole)(new nestjs_pino_1.PinoLogger(config));
|
|
20
|
+
}
|
|
16
21
|
return (0, server_common_1.moduleFactory)({
|
|
17
22
|
module: ServerPinoModule_1,
|
|
23
|
+
imports: [nestjs_pino_1.LoggerModule.forRoot(config)],
|
|
18
24
|
providers: [
|
|
19
25
|
{ provide: server_pino_config_class_1.ServerPinoConfig, useValue: config },
|
|
26
|
+
// { provide: Logger, useFactory: (logger: PinoLogger) => logger, inject: [PinoLogger] }
|
|
20
27
|
]
|
|
21
28
|
});
|
|
22
29
|
}
|
package/dist/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onivoro/server-pino",
|
|
3
|
-
"version": "22.0.
|
|
3
|
+
"version": "22.0.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"url": "git+https://github.com/onivoro/server-pino.git"
|
|
6
6
|
},
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
"@onivoro/server-common": "^22.0.3",
|
|
45
45
|
"nestjs-pino": "^4.1.0"
|
|
46
46
|
}
|
|
47
|
-
}
|
|
47
|
+
}
|