nestjs-logger-module 1.5.1 → 1.6.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/LICENSE +21 -0
- package/README.md +51 -98
- package/dist/logger.module.js +6 -2
- package/dist/logger.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +2 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Novatorsoft
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,98 +1,51 @@
|
|
|
1
|
-
<p align="center">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
<
|
|
12
|
-
|
|
13
|
-
<
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
# e2e tests
|
|
54
|
-
$ yarn run test:e2e
|
|
55
|
-
|
|
56
|
-
# test coverage
|
|
57
|
-
$ yarn run test:cov
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
## Deployment
|
|
61
|
-
|
|
62
|
-
When you're ready to deploy your NestJS application to production, there are some key steps you can take to ensure it runs as efficiently as possible. Check out the [deployment documentation](https://docs.nestjs.com/deployment) for more information.
|
|
63
|
-
|
|
64
|
-
If you are looking for a cloud-based platform to deploy your NestJS application, check out [Mau](https://mau.nestjs.com), our official platform for deploying NestJS applications on AWS. Mau makes deployment straightforward and fast, requiring just a few simple steps:
|
|
65
|
-
|
|
66
|
-
```bash
|
|
67
|
-
$ yarn install -g @nestjs/mau
|
|
68
|
-
$ mau deploy
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
With Mau, you can deploy your application in just a few clicks, allowing you to focus on building features rather than managing infrastructure.
|
|
72
|
-
|
|
73
|
-
## Resources
|
|
74
|
-
|
|
75
|
-
Check out a few resources that may come in handy when working with NestJS:
|
|
76
|
-
|
|
77
|
-
- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
|
|
78
|
-
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
|
|
79
|
-
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
|
|
80
|
-
- Deploy your application to AWS with the help of [NestJS Mau](https://mau.nestjs.com) in just a few clicks.
|
|
81
|
-
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
|
|
82
|
-
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
|
|
83
|
-
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
|
|
84
|
-
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).
|
|
85
|
-
|
|
86
|
-
## Support
|
|
87
|
-
|
|
88
|
-
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).
|
|
89
|
-
|
|
90
|
-
## Stay in touch
|
|
91
|
-
|
|
92
|
-
- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
|
|
93
|
-
- Website - [https://nestjs.com](https://nestjs.com/)
|
|
94
|
-
- Twitter - [@nestframework](https://twitter.com/nestframework)
|
|
95
|
-
|
|
96
|
-
## License
|
|
97
|
-
|
|
98
|
-
Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://novatorsoft.com" target="_blank">
|
|
3
|
+
<img
|
|
4
|
+
src="https://os.novatorsoft.com/novatorsoft/dark-logo.png"
|
|
5
|
+
width="700"
|
|
6
|
+
alt="Novatorsoft Logo"
|
|
7
|
+
/>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<h1 align="center">NestJS Logger Module</h1>
|
|
12
|
+
|
|
13
|
+
<p align="center">
|
|
14
|
+
A NestJS logging module that provides a provider-based abstraction for logging with support for Console, File, and MongoDB providers.
|
|
15
|
+
</p>
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<a href="https://sonarcloud.io/summary/overall?id=novatorsoft_nestjs-logger-module" target="_blank"><img src="https://sonarcloud.io/api/project_badges/measure?project=novatorsoft_nestjs-logger-module&metric=alert_status"/></a>
|
|
19
|
+
<a href="https://sonarcloud.io/summary/overall?id=novatorsoft_nestjs-logger-module" target="_blank"><img src="https://sonarcloud.io/api/project_badges/measure?project=novatorsoft_nestjs-logger-module&metric=coverage"/></a>
|
|
20
|
+
<a href="https://www.npmjs.com/package/nestjs-logger-module" target="_blank">
|
|
21
|
+
<img src="https://img.shields.io/npm/v/nestjs-logger-module.svg" alt="NPM Version" />
|
|
22
|
+
</a>
|
|
23
|
+
<a href="https://www.npmjs.com/package/nestjs-logger-module" target="_blank">
|
|
24
|
+
<img src="https://img.shields.io/npm/l/nestjs-logger-module.svg" alt="Package License" />
|
|
25
|
+
</a>
|
|
26
|
+
<a href="https://www.npmjs.com/package/nestjs-logger-module" target="_blank">
|
|
27
|
+
<img src="https://img.shields.io/npm/dm/nestjs-logger-module.svg" alt="NPM Downloads" />
|
|
28
|
+
</a>
|
|
29
|
+
</p>
|
|
30
|
+
|
|
31
|
+
<p align="center">
|
|
32
|
+
<a href="https://www.instagram.com/novatorsoft/" target="_blank">
|
|
33
|
+
<img src="https://img.shields.io/badge/Instagram-E4405F?style=for-the-badge&logo=instagram&logoColor=white" alt="Instagram" />
|
|
34
|
+
</a>
|
|
35
|
+
<a href="https://www.linkedin.com/company/novatorsoft/" target="_blank">
|
|
36
|
+
<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" alt="LinkedIn" />
|
|
37
|
+
</a>
|
|
38
|
+
</p>
|
|
39
|
+
|
|
40
|
+
## About
|
|
41
|
+
|
|
42
|
+
NestJS Logger Module helps you standardize logging across your application by exposing a single `LoggerService` API while keeping provider-specific details (Console, File, MongoDB) configurable. It also supports automatic log retention with configurable cleanup policies.
|
|
43
|
+
|
|
44
|
+
## Documentation
|
|
45
|
+
|
|
46
|
+
For installation, usage, configuration, and examples, see the documentation:
|
|
47
|
+
- [Documentation](https://opensource.novatorsoft.com/docs/nestjs-logger-module/intro)
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
MIT — see [LICENSE](./LICENSE).
|
package/dist/logger.module.js
CHANGED
|
@@ -12,11 +12,11 @@ const providers_1 = require("./providers");
|
|
|
12
12
|
const common_1 = require("@nestjs/common");
|
|
13
13
|
const config_1 = require("./config");
|
|
14
14
|
const log_scheme_1 = require("./providers/mongo/log.scheme");
|
|
15
|
+
const mongoose_1 = require("@nestjs/mongoose");
|
|
15
16
|
const log_cleanup_service_1 = require("./log-cleanup.service");
|
|
16
17
|
const logger_config_module_1 = require("./logger-config.module");
|
|
17
18
|
const enum_1 = require("./enum");
|
|
18
19
|
const logger_service_1 = require("./logger.service");
|
|
19
|
-
const mongoose_1 = require("@nestjs/mongoose");
|
|
20
20
|
let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
21
21
|
static register(config) {
|
|
22
22
|
const loggerModuleConfig = LoggerModule_1.getLoggerProviderModuleConfig(config?.provider, config);
|
|
@@ -64,6 +64,11 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
|
64
64
|
provide: logger_service_1.LoggerService,
|
|
65
65
|
useClass: providers_1.MongoService,
|
|
66
66
|
},
|
|
67
|
+
{
|
|
68
|
+
provide: (0, mongoose_1.getModelToken)(log_scheme_1.Log.name),
|
|
69
|
+
useFactory: (connection, loggerConfig) => connection.model(log_scheme_1.Log.name, log_scheme_1.LogSchema, loggerConfig?.schemaName ?? 'logger'),
|
|
70
|
+
inject: [(0, mongoose_1.getConnectionToken)(), config_1.LOGGER_CONFIG],
|
|
71
|
+
},
|
|
67
72
|
],
|
|
68
73
|
imports: [
|
|
69
74
|
loggerConfigModule,
|
|
@@ -76,7 +81,6 @@ let LoggerModule = LoggerModule_1 = class LoggerModule {
|
|
|
76
81
|
},
|
|
77
82
|
inject: [config_1.LOGGER_CONFIG],
|
|
78
83
|
}),
|
|
79
|
-
mongoose_1.MongooseModule.forFeature([{ name: log_scheme_1.Log.name, schema: log_scheme_1.LogSchema }]),
|
|
80
84
|
],
|
|
81
85
|
};
|
|
82
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logger.module.js","sourceRoot":"","sources":["../src/logger.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAKqB;AACrB,2CAAuD;AACvD,qCAA8E;AAC9E,6DAA8D;
|
|
1
|
+
{"version":3,"file":"logger.module.js","sourceRoot":"","sources":["../src/logger.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAKqB;AACrB,2CAAuD;AACvD,qCAA8E;AAC9E,6DAA8D;AAC9D,+CAI0B;AAG1B,+DAA0D;AAC1D,iEAA4D;AAC5D,iCAAwC;AACxC,qDAAiD;AAG1C,IAAM,YAAY,oBAAlB,MAAM,YAAY;IACvB,MAAM,CAAC,QAAQ,CAAC,MAAwB;QACtC,MAAM,kBAAkB,GAAG,cAAY,CAAC,6BAA6B,CACnE,MAAM,EAAE,QAAQ,EAChB,MAAM,CACP,CAAC;QAEF,OAAO;YACL,MAAM,EAAE,cAAY;YACpB,MAAM,EAAE,MAAM,EAAE,QAAQ,IAAI,KAAK;YACjC,OAAO,EAAE;gBACP,GAAG,kBAAkB,CAAC,OAAO;gBAC7B,yCAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC;aACpC;YACD,SAAS,EAAE,CAAC,GAAG,kBAAkB,CAAC,QAAQ,EAAE,uCAAiB,CAAC;YAC9D,OAAO,EAAE,CAAC,8BAAa,CAAC;SACzB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,aAAa,CAAC,MAAyB;QAC5C,MAAM,kBAAkB,GAAG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