@nicollasfrazao/liguelead-log-service 1.0.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 +15 -0
- package/README.md +689 -0
- package/dist/configs/log.service.config.d.ts +8 -0
- package/dist/configs/log.service.config.d.ts.map +1 -0
- package/dist/configs/log.service.config.js +50 -0
- package/dist/configs/log.service.config.js.map +1 -0
- package/dist/configs/log.storage.external.s3.config.d.ts +8 -0
- package/dist/configs/log.storage.external.s3.config.d.ts.map +1 -0
- package/dist/configs/log.storage.external.s3.config.js +27 -0
- package/dist/configs/log.storage.external.s3.config.js.map +1 -0
- package/dist/errors/log.error.d.ts +25 -0
- package/dist/errors/log.error.d.ts.map +1 -0
- package/dist/errors/log.error.js +27 -0
- package/dist/errors/log.error.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/log.service.config.interface.d.ts +84 -0
- package/dist/interfaces/log.service.config.interface.d.ts.map +1 -0
- package/dist/interfaces/log.service.config.interface.js +3 -0
- package/dist/interfaces/log.service.config.interface.js.map +1 -0
- package/dist/interfaces/log.storage.base.service.interface.d.ts +21 -0
- package/dist/interfaces/log.storage.base.service.interface.d.ts.map +1 -0
- package/dist/interfaces/log.storage.base.service.interface.js +3 -0
- package/dist/interfaces/log.storage.base.service.interface.js.map +1 -0
- package/dist/interfaces/log.storage.external.s3.service.config.interface.d.ts +39 -0
- package/dist/interfaces/log.storage.external.s3.service.config.interface.d.ts.map +1 -0
- package/dist/interfaces/log.storage.external.s3.service.config.interface.js +3 -0
- package/dist/interfaces/log.storage.external.s3.service.config.interface.js.map +1 -0
- package/dist/middlewares/log.middleware.d.ts +12 -0
- package/dist/middlewares/log.middleware.d.ts.map +1 -0
- package/dist/middlewares/log.middleware.js +63 -0
- package/dist/middlewares/log.middleware.js.map +1 -0
- package/dist/services/log.service.d.ts +224 -0
- package/dist/services/log.service.d.ts.map +1 -0
- package/dist/services/log.service.js +572 -0
- package/dist/services/log.service.js.map +1 -0
- package/dist/services/log.storage.base.service.d.ts +77 -0
- package/dist/services/log.storage.base.service.d.ts.map +1 -0
- package/dist/services/log.storage.base.service.js +107 -0
- package/dist/services/log.storage.base.service.js.map +1 -0
- package/dist/services/log.storage.external.s3.service.d.ts +66 -0
- package/dist/services/log.storage.external.s3.service.d.ts.map +1 -0
- package/dist/services/log.storage.external.s3.service.js +121 -0
- package/dist/services/log.storage.external.s3.service.js.map +1 -0
- package/dist/services/log.storage.external.service.d.ts +17 -0
- package/dist/services/log.storage.external.service.d.ts.map +1 -0
- package/dist/services/log.storage.external.service.js +22 -0
- package/dist/services/log.storage.external.service.js.map +1 -0
- package/dist/services/log.storage.local.service.d.ts +38 -0
- package/dist/services/log.storage.local.service.d.ts.map +1 -0
- package/dist/services/log.storage.local.service.js +96 -0
- package/dist/services/log.storage.local.service.js.map +1 -0
- package/dist/services/log.storage.service.d.ts +62 -0
- package/dist/services/log.storage.service.d.ts.map +1 -0
- package/dist/services/log.storage.service.js +92 -0
- package/dist/services/log.storage.service.js.map +1 -0
- package/dist/types/log.context.type.d.ts +74 -0
- package/dist/types/log.context.type.d.ts.map +1 -0
- package/dist/types/log.context.type.js +3 -0
- package/dist/types/log.context.type.js.map +1 -0
- package/dist/types/log.type.d.ts +45 -0
- package/dist/types/log.type.d.ts.map +1 -0
- package/dist/types/log.type.js +3 -0
- package/dist/types/log.type.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type LogContextType
|
|
3
|
+
*
|
|
4
|
+
* Type representing the context of a log entry
|
|
5
|
+
*
|
|
6
|
+
* @property {string} method
|
|
7
|
+
* @property {string} url
|
|
8
|
+
* @property {string} user_agent
|
|
9
|
+
* @property {string} ip
|
|
10
|
+
* @property {any} request
|
|
11
|
+
* @property {any} response
|
|
12
|
+
* @property {number} status_code
|
|
13
|
+
* @property {number} response_time
|
|
14
|
+
* @property {string} error
|
|
15
|
+
* @property {string} stack
|
|
16
|
+
* @property {string} user_id
|
|
17
|
+
* @property {Record<string, any>} headers
|
|
18
|
+
* @property {string} content_type
|
|
19
|
+
*/
|
|
20
|
+
export type LogContextType = {
|
|
21
|
+
/**
|
|
22
|
+
* @var {string}
|
|
23
|
+
*/
|
|
24
|
+
method: string;
|
|
25
|
+
/**
|
|
26
|
+
* @var {string}
|
|
27
|
+
*/
|
|
28
|
+
url: string;
|
|
29
|
+
/**
|
|
30
|
+
* @var {string}
|
|
31
|
+
*/
|
|
32
|
+
user_agent?: string;
|
|
33
|
+
/**
|
|
34
|
+
* @var {string}
|
|
35
|
+
*/
|
|
36
|
+
ip: string;
|
|
37
|
+
/**
|
|
38
|
+
* @var {any}
|
|
39
|
+
*/
|
|
40
|
+
request?: any;
|
|
41
|
+
/**
|
|
42
|
+
* @var {any}
|
|
43
|
+
*/
|
|
44
|
+
response?: any;
|
|
45
|
+
/**
|
|
46
|
+
* @var {number}
|
|
47
|
+
*/
|
|
48
|
+
status_code?: number;
|
|
49
|
+
/**
|
|
50
|
+
* @var {number}
|
|
51
|
+
*/
|
|
52
|
+
response_time?: number;
|
|
53
|
+
/**
|
|
54
|
+
* @var {string}
|
|
55
|
+
*/
|
|
56
|
+
error?: string;
|
|
57
|
+
/**
|
|
58
|
+
* @var {string}
|
|
59
|
+
*/
|
|
60
|
+
stack?: string;
|
|
61
|
+
/**
|
|
62
|
+
* @var {string}
|
|
63
|
+
*/
|
|
64
|
+
user_id?: string;
|
|
65
|
+
/**
|
|
66
|
+
* @var {Record<string, any>}
|
|
67
|
+
*/
|
|
68
|
+
headers?: Record<string, any>;
|
|
69
|
+
/**
|
|
70
|
+
* @var {string}
|
|
71
|
+
*/
|
|
72
|
+
content_type?: string;
|
|
73
|
+
};
|
|
74
|
+
//# sourceMappingURL=log.context.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.context.type.d.ts","sourceRoot":"","sources":["../../src/types/log.context.type.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC;IAEf;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAE9B;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.context.type.js","sourceRoot":"","sources":["../../src/types/log.context.type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { LogContextType } from "./log.context.type";
|
|
2
|
+
/**
|
|
3
|
+
* Type LogType
|
|
4
|
+
*
|
|
5
|
+
* Type representing the structure of a log entry
|
|
6
|
+
*
|
|
7
|
+
* @property {string} timestamp
|
|
8
|
+
* @property {string} level
|
|
9
|
+
* @property {string} environment
|
|
10
|
+
* @property {string} service
|
|
11
|
+
* @property {string} correlation_id
|
|
12
|
+
* @property {string} message
|
|
13
|
+
* @property {LogContextType} context
|
|
14
|
+
*/
|
|
15
|
+
export type LogType = {
|
|
16
|
+
/**
|
|
17
|
+
* @var {string}
|
|
18
|
+
*/
|
|
19
|
+
timestamp: string;
|
|
20
|
+
/**
|
|
21
|
+
* @var {string}
|
|
22
|
+
*/
|
|
23
|
+
level: 'info' | 'warn' | 'error' | 'debug';
|
|
24
|
+
/**
|
|
25
|
+
* @var {string}
|
|
26
|
+
*/
|
|
27
|
+
environment: 'development' | 'homologation' | 'production' | 'test';
|
|
28
|
+
/**
|
|
29
|
+
* @var {string}
|
|
30
|
+
*/
|
|
31
|
+
service: string;
|
|
32
|
+
/**
|
|
33
|
+
* @var {string}
|
|
34
|
+
*/
|
|
35
|
+
correlation_id: string;
|
|
36
|
+
/**
|
|
37
|
+
* @var {string}
|
|
38
|
+
*/
|
|
39
|
+
message: string;
|
|
40
|
+
/**
|
|
41
|
+
* @var {LogContext}
|
|
42
|
+
*/
|
|
43
|
+
context?: LogContextType;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=log.type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.type.d.ts","sourceRoot":"","sources":["../../src/types/log.type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,OAAO,GAAG;IACpB;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAC;IAE3C;;OAEG;IACH,WAAW,EAAE,aAAa,GAAG,cAAc,GAAG,YAAY,GAAG,MAAM,CAAC;IAEpE;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;CAC1B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log.type.js","sourceRoot":"","sources":["../../src/types/log.type.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nicollasfrazao/liguelead-log-service",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "A standalone logging service for Express applications with multi-destination storage (local files + S3 via Kinesis Firehose) and comprehensive request tracking using strategy pattern.",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/**/*",
|
|
9
|
+
"README.md",
|
|
10
|
+
"LICENSE"
|
|
11
|
+
],
|
|
12
|
+
"scripts": {
|
|
13
|
+
"build": "tsc",
|
|
14
|
+
"clean": "rm -rf dist",
|
|
15
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"logging",
|
|
21
|
+
"express",
|
|
22
|
+
"middleware",
|
|
23
|
+
"aws",
|
|
24
|
+
"s3",
|
|
25
|
+
"kinesis",
|
|
26
|
+
"firehose",
|
|
27
|
+
"typescript",
|
|
28
|
+
"nodejs",
|
|
29
|
+
"correlation-id",
|
|
30
|
+
"request-tracking",
|
|
31
|
+
"structured-logging"
|
|
32
|
+
],
|
|
33
|
+
"author": "Ligue Lead Tech",
|
|
34
|
+
"license": "ISC",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "git+https://github.com/ligue-lead-tech/log-service-nodejs.git"
|
|
38
|
+
},
|
|
39
|
+
"bugs": {
|
|
40
|
+
"url": "https://github.com/ligue-lead-tech/log-service-nodejs/issues"
|
|
41
|
+
},
|
|
42
|
+
"homepage": "https://github.com/ligue-lead-tech/log-service-nodejs#readme",
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=16.0.0"
|
|
45
|
+
},
|
|
46
|
+
"peerDependencies": {
|
|
47
|
+
"express": "^4.0.0 || ^5.0.0"
|
|
48
|
+
},
|
|
49
|
+
"dependencies": {
|
|
50
|
+
"@aws-sdk/client-firehose": "^3.658.1",
|
|
51
|
+
"@aws-sdk/client-s3": "^3.658.1",
|
|
52
|
+
"uuid": "^9.0.1"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@types/express": "^5.0.4",
|
|
56
|
+
"@types/node": "^24.9.1",
|
|
57
|
+
"@types/uuid": "^9.0.8",
|
|
58
|
+
"express": "^5.1.0",
|
|
59
|
+
"typescript": "^5.9.3"
|
|
60
|
+
},
|
|
61
|
+
"directories": {
|
|
62
|
+
"doc": "docs"
|
|
63
|
+
}
|
|
64
|
+
}
|