@rxap/nest-logger 1.0.1-dev.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/CHANGELOG.md +10 -0
- package/GETSTARTED.md +0 -0
- package/GUIDES.md +0 -0
- package/README.md +17 -0
- package/package.json +39 -0
- package/src/index.d.ts +1 -0
- package/src/index.js +5 -0
- package/src/index.js.map +1 -0
- package/src/lib/logger.d.ts +13 -0
- package/src/lib/logger.js +71 -0
- package/src/lib/logger.js.map +1 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
|
+
|
|
6
|
+
## 1.0.1-dev.0 (2023-07-10)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- restructure and merge mono repos packages, schematics, plugins and nest ([653b4cd](https://gitlab.com/rxap/packages/commit/653b4cd39fc92d322df9b3959651fea0aa6079da))
|
package/GETSTARTED.md
ADDED
|
File without changes
|
package/GUIDES.md
ADDED
|
File without changes
|
package/README.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# @rxap/nest-logger
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@rxap/nest-logger)
|
|
4
|
+
[](https://commitizen.github.io/cz-cli/)
|
|
5
|
+
[](https://github.com/prettier/prettier)
|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
|
|
12
|
+
# Installation
|
|
13
|
+
|
|
14
|
+
**Add the package to your workspace:**
|
|
15
|
+
```bash
|
|
16
|
+
yarn add @rxap/nest-logger
|
|
17
|
+
```
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rxap/nest-logger",
|
|
3
|
+
"version": "1.0.1-dev.0",
|
|
4
|
+
"type": "commonjs",
|
|
5
|
+
"dependencies": {
|
|
6
|
+
"tslib": "2.5.3"
|
|
7
|
+
},
|
|
8
|
+
"peerDependencies": {
|
|
9
|
+
"@nestjs/common": "^9.2.1"
|
|
10
|
+
},
|
|
11
|
+
"publishConfig": {
|
|
12
|
+
"access": "public",
|
|
13
|
+
"directory": "../../../dist/packages/nest/logger"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"rxap",
|
|
17
|
+
"nest"
|
|
18
|
+
],
|
|
19
|
+
"homepage": "https:/gitlab.com/rxap/packages/packages/nest/logger",
|
|
20
|
+
"bugs": {
|
|
21
|
+
"url": "https://gitlab.com/rxap/packages/-/issues",
|
|
22
|
+
"email": "incoming+rxap-packages-14898188-issue-@incoming.gitlab.com"
|
|
23
|
+
},
|
|
24
|
+
"license": "GPL-3.0-or-later",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://gitlab.com/rxap/packages.git",
|
|
28
|
+
"directory": "packages/nest/logger"
|
|
29
|
+
},
|
|
30
|
+
"author": {
|
|
31
|
+
"name": "Merzough Münker",
|
|
32
|
+
"email": "mmuenker@digitaix.com"
|
|
33
|
+
},
|
|
34
|
+
"nx-migrations": {
|
|
35
|
+
"packageGroup": []
|
|
36
|
+
},
|
|
37
|
+
"main": "./src/index.js",
|
|
38
|
+
"types": "./src/index.d.ts"
|
|
39
|
+
}
|
package/src/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './lib/logger';
|
package/src/index.js
ADDED
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/nest/logger/src/index.ts"],"names":[],"mappings":";;;AAAA,uDAA6B"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ConsoleLogger, LogLevel } from '@nestjs/common';
|
|
2
|
+
export declare class RxapLogger extends ConsoleLogger {
|
|
3
|
+
log(message: string, ...optionalParams: any[]): void;
|
|
4
|
+
error(message: string, ...optionalParams: any[]): void;
|
|
5
|
+
warn(message: string, ...optionalParams: any[]): void;
|
|
6
|
+
debug(message: string, ...optionalParams: any[]): void;
|
|
7
|
+
verbose(message: string, ...optionalParams: any[]): void;
|
|
8
|
+
protected interpolate(message: unknown, optionalParams: any[], logLevel: LogLevel): {
|
|
9
|
+
msg: unknown;
|
|
10
|
+
params: any[];
|
|
11
|
+
};
|
|
12
|
+
protected stringifyCircular(obj: any): string;
|
|
13
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RxapLogger = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const common_1 = require("@nestjs/common");
|
|
6
|
+
let RxapLogger = exports.RxapLogger = class RxapLogger extends common_1.ConsoleLogger {
|
|
7
|
+
log(message, ...optionalParams) {
|
|
8
|
+
const { msg, params, } = this.interpolate(message, optionalParams, 'log');
|
|
9
|
+
super.log(msg, ...params);
|
|
10
|
+
}
|
|
11
|
+
error(message, ...optionalParams) {
|
|
12
|
+
const { msg, params, } = this.interpolate(message, optionalParams, 'error');
|
|
13
|
+
super.error(msg, ...params);
|
|
14
|
+
}
|
|
15
|
+
warn(message, ...optionalParams) {
|
|
16
|
+
const { msg, params, } = this.interpolate(message, optionalParams, 'warn');
|
|
17
|
+
super.warn(msg, ...params);
|
|
18
|
+
}
|
|
19
|
+
debug(message, ...optionalParams) {
|
|
20
|
+
const { msg, params, } = this.interpolate(message, optionalParams, 'debug');
|
|
21
|
+
super.debug(msg, ...params);
|
|
22
|
+
}
|
|
23
|
+
verbose(message, ...optionalParams) {
|
|
24
|
+
const { msg, params, } = this.interpolate(message, optionalParams, 'verbose');
|
|
25
|
+
super.verbose(msg, ...params);
|
|
26
|
+
}
|
|
27
|
+
interpolate(message, optionalParams, logLevel) {
|
|
28
|
+
if (this.isLevelEnabled(logLevel) && typeof message === 'string') {
|
|
29
|
+
if (message.includes('%JSON')) {
|
|
30
|
+
// replace each %JSON with the corresponding optionalParam
|
|
31
|
+
const msg = message.replace(/%JSON/g, () => {
|
|
32
|
+
if (optionalParams.length) {
|
|
33
|
+
const param = optionalParams.shift();
|
|
34
|
+
if (param && typeof param === 'object') {
|
|
35
|
+
return this.stringifyCircular(param);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
optionalParams.unshift(param);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return '<json>';
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
msg,
|
|
45
|
+
params: optionalParams,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
msg: message,
|
|
51
|
+
params: optionalParams,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
stringifyCircular(obj) {
|
|
55
|
+
const seenObjects = new Set();
|
|
56
|
+
return JSON.stringify(obj, (key, value) => {
|
|
57
|
+
if (typeof value === 'object' && value !== null) {
|
|
58
|
+
if (seenObjects.has(value)) {
|
|
59
|
+
// Detected a circular reference, replace it with a custom string or value
|
|
60
|
+
return '[Circular]';
|
|
61
|
+
}
|
|
62
|
+
seenObjects.add(value);
|
|
63
|
+
}
|
|
64
|
+
return value;
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
exports.RxapLogger = RxapLogger = tslib_1.__decorate([
|
|
69
|
+
(0, common_1.Injectable)()
|
|
70
|
+
], RxapLogger);
|
|
71
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../../../../../packages/nest/logger/src/lib/logger.ts"],"names":[],"mappings":";;;;AAAA,2CAIwB;AAGjB,IAAM,UAAU,wBAAhB,MAAM,UAAW,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