@tc-libs/debugger 4.0.0 → 4.1.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/README.md +67 -0
- package/package.json +9 -7
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @tc-libs/debugger
|
|
2
|
+
|
|
3
|
+
Layer di logging/debug operativo basato su `winston`, separato dal package `@tc-libs/logger`.
|
|
4
|
+
|
|
5
|
+
Questo package e orientato soprattutto a:
|
|
6
|
+
|
|
7
|
+
- log applicativi generici
|
|
8
|
+
- log HTTP strutturati
|
|
9
|
+
- output su console, file e Telegram
|
|
10
|
+
|
|
11
|
+
## Registrazione
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
DebuggerModule.register(
|
|
15
|
+
{
|
|
16
|
+
system: {
|
|
17
|
+
writeIntoConsole: true,
|
|
18
|
+
writeIntoTelegram: false,
|
|
19
|
+
writeIntoFile: true,
|
|
20
|
+
maxSize: '10M',
|
|
21
|
+
maxFiles: '14d',
|
|
22
|
+
},
|
|
23
|
+
telegram: {
|
|
24
|
+
chatId: process.env.DEBUG_TELEGRAM_CHAT_ID!,
|
|
25
|
+
apiToken: process.env.DEBUG_TELEGRAM_BOT_TOKEN!,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
true,
|
|
29
|
+
);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Servizio
|
|
33
|
+
|
|
34
|
+
`DebuggerService` espone:
|
|
35
|
+
|
|
36
|
+
- `info`, `debug`, `warn`, `error`
|
|
37
|
+
- `infoHttp`, `debugHttp`, `warnHttp`, `errorHttp`
|
|
38
|
+
|
|
39
|
+
Esempio:
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
this.debuggerService.info('Cache warmed', { keys: 12 });
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Per HTTP:
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
this.debuggerService.errorHttp(requestId, {
|
|
49
|
+
description: 'Unhandled exception',
|
|
50
|
+
class: 'UserController',
|
|
51
|
+
function: 'create',
|
|
52
|
+
path: '/api/v1/users',
|
|
53
|
+
data: payload,
|
|
54
|
+
}, error);
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Differenza rispetto a `@tc-libs/logger`
|
|
58
|
+
|
|
59
|
+
- `logger`: factory di logger contestuali, piu semplice
|
|
60
|
+
- `debugger`: pipeline piu strutturata con output multipli e metodi HTTP dedicati
|
|
61
|
+
|
|
62
|
+
## Sviluppo
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
nx build debugger
|
|
66
|
+
nx test debugger
|
|
67
|
+
```
|
package/package.json
CHANGED
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tc-libs/debugger",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"dependencies": {
|
|
5
|
-
"@tc-libs/errors": "4.0.0",
|
|
6
|
-
"@nestjs/common": "^11.0.12",
|
|
7
5
|
"@aws-sdk/client-cloudwatch-logs": "^3.779.0",
|
|
8
|
-
"
|
|
9
|
-
"winston-transport": "^4.9.0",
|
|
6
|
+
"@tc-libs/errors": "4.1.0",
|
|
10
7
|
"telegraf": "^4.16.3",
|
|
8
|
+
"tslib": "^2.8.1",
|
|
9
|
+
"winston": "^3.17.0",
|
|
11
10
|
"winston-daily-rotate-file": "^5.0.0",
|
|
12
|
-
"
|
|
11
|
+
"winston-transport": "^4.9.0"
|
|
13
12
|
},
|
|
14
13
|
"type": "commonjs",
|
|
15
14
|
"main": "./src/index.js",
|
|
16
15
|
"typings": "./src/index.d.ts",
|
|
17
|
-
"
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@nestjs/common": "^11.0.12"
|
|
18
|
+
},
|
|
19
|
+
"types": "./src/index.d.ts"
|
|
18
20
|
}
|