@tc-libs/debugger 3.6.0 → 3.6.1

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.
Files changed (2) hide show
  1. package/README.md +62 -6
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,11 +1,67 @@
1
- # debugger
1
+ # @tc-libs/debugger
2
2
 
3
- This library was generated with [Nx](https://nx.dev).
3
+ Layer di logging/debug operativo basato su `winston`, separato dal package `@tc-libs/logger`.
4
4
 
5
- ## Building
5
+ Questo package e orientato soprattutto a:
6
6
 
7
- Run `nx build debugger` to build the library.
7
+ - log applicativi generici
8
+ - log HTTP strutturati
9
+ - output su console, file e Telegram
8
10
 
9
- ## Running unit tests
11
+ ## Registrazione
10
12
 
11
- Run `nx test debugger` to execute the unit tests via [Jest](https://jestjs.io).
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,8 +1,8 @@
1
1
  {
2
2
  "name": "@tc-libs/debugger",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "dependencies": {
5
- "@tc-libs/errors": "3.6.0",
5
+ "@tc-libs/errors": "3.6.1",
6
6
  "@nestjs/common": "^11.0.12",
7
7
  "winston": "^3.17.0",
8
8
  "winston-transport": "^4.9.0",