lhisp-logger 1.0.16 → 1.0.18

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/package.json CHANGED
@@ -1,11 +1,12 @@
1
1
  {
2
2
  "name": "lhisp-logger",
3
- "version": "1.0.16",
3
+ "version": "1.0.18",
4
4
  "description": "",
5
5
  "main": "src/lhisp-logger",
6
6
  "types": "src/lhisp-logger.d.ts",
7
7
  "scripts": {
8
- "build": "tsc"
8
+ "build": "tsc",
9
+ "test": "echo NO TESTS"
9
10
  },
10
11
  "repository": {
11
12
  "type": "git",
@@ -19,12 +20,13 @@
19
20
  },
20
21
  "homepage": "https://bitbucket.org/leandro_costa/lhisp-logger#readme",
21
22
  "devDependencies": {
22
- "@types/node": "^18.16.3",
23
+ "@types/node": "^24.3.0",
23
24
  "@types/pino": "^7.0.5",
24
- "typescript": "^5.0.4"
25
+ "typescript": "^5.9.2"
25
26
  },
26
27
  "dependencies": {
27
- "@logtail/pino": "^0.4.12",
28
- "pino": "^8.11.0"
28
+ "@logtail/pino": "^0.5.5",
29
+ "pino": "^9.9.0",
30
+ "pino-pretty": "^13.1.1"
29
31
  }
30
32
  }
@@ -0,0 +1,9 @@
1
+ export declare const axiosErrorSerializer: (err: any) => {
2
+ message: any;
3
+ config: any;
4
+ response: {
5
+ status: any;
6
+ data: any;
7
+ headers: any;
8
+ } | undefined;
9
+ };
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.axiosErrorSerializer = void 0;
4
+ const axiosErrorSerializer = (err) => {
5
+ var _a, _b;
6
+ if ((_a = err === null || err === void 0 ? void 0 : err.config) === null || _a === void 0 ? void 0 : _a.httpsAgent)
7
+ err.config.httpsAgent = err.config.httpsAgent ? "[REDACTED]" : undefined;
8
+ if ((_b = err === null || err === void 0 ? void 0 : err.config) === null || _b === void 0 ? void 0 : _b.headers) {
9
+ err.config.headers.Authorization = err.config.headers.Authorization ? "[REDACTED]" : undefined;
10
+ err.config.headers.authorization = err.config.headers.authorization ? "[REDACTED]" : undefined;
11
+ }
12
+ return {
13
+ message: err.message,
14
+ config: err.config,
15
+ response: err.response
16
+ ? {
17
+ status: err.response.status,
18
+ data: err.response.data,
19
+ headers: err.response.headers,
20
+ }
21
+ : undefined,
22
+ };
23
+ };
24
+ exports.axiosErrorSerializer = axiosErrorSerializer;
@@ -0,0 +1 @@
1
+ export declare const isAxiosError: (error: any) => any;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isAxiosError = void 0;
4
+ const isAxiosError = (error) => {
5
+ const isObject = error !== null && typeof error === "object";
6
+ return isObject && (error === null || error === void 0 ? void 0 : error.config);
7
+ };
8
+ exports.isAxiosError = isAxiosError;
@@ -1,46 +1,3 @@
1
- export declare const isAxiosError: (error: any) => any;
2
- export declare const axiosErrorSerializer: (err: any) => {
3
- message: any;
4
- config: any;
5
- response: {
6
- status: any;
7
- data: any;
8
- headers: any;
9
- } | undefined;
10
- };
11
- declare const logger: import("pino").Logger<{
12
- base?: undefined;
13
- name: string | undefined;
14
- level: string;
15
- serializers: {
16
- err: (error: any) => {
17
- message: any;
18
- config: any;
19
- response: {
20
- status: any;
21
- data: any;
22
- headers: any;
23
- } | undefined;
24
- } | import("pino-std-serializers").SerializedError;
25
- error: (error: any) => {
26
- message: any;
27
- config: any;
28
- response: {
29
- status: any;
30
- data: any;
31
- headers: any;
32
- } | undefined;
33
- } | import("pino-std-serializers").SerializedError;
34
- axiosError: (err: any) => {
35
- message: any;
36
- config: any;
37
- response: {
38
- status: any;
39
- data: any;
40
- headers: any;
41
- } | undefined;
42
- };
43
- };
44
- transport: any;
45
- }>;
1
+ import pino from "pino";
2
+ export declare const logger: pino.Logger<never, boolean>;
46
3
  export default logger;
@@ -3,44 +3,32 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.axiosErrorSerializer = exports.isAxiosError = void 0;
6
+ exports.logger = void 0;
7
7
  const pino_1 = __importDefault(require("pino"));
8
- const isAxiosError = (error) => {
9
- const isObject = error !== null && typeof error === "object";
10
- return isObject && (error === null || error === void 0 ? void 0 : error.config);
11
- };
12
- exports.isAxiosError = isAxiosError;
13
- const axiosErrorSerializer = (err) => {
14
- var _a, _b;
15
- if ((_a = err === null || err === void 0 ? void 0 : err.config) === null || _a === void 0 ? void 0 : _a.httpsAgent)
16
- err.config.httpsAgent = err.config.httpsAgent ? "[REDACTED]" : undefined;
17
- if ((_b = err === null || err === void 0 ? void 0 : err.config) === null || _b === void 0 ? void 0 : _b.headers) {
18
- err.config.headers.Authorization = err.config.headers.Authorization ? "[REDACTED]" : undefined;
19
- err.config.headers.authorization = err.config.headers.authorization ? "[REDACTED]" : undefined;
20
- }
21
- return {
22
- message: err.message,
23
- config: err.config,
24
- response: err.response
25
- ? {
26
- status: err.response.status,
27
- data: err.response.data,
28
- headers: err.response.headers,
29
- }
30
- : undefined,
31
- };
32
- };
33
- exports.axiosErrorSerializer = axiosErrorSerializer;
34
- const logger = (0, pino_1.default)(Object.assign({ name: process.env.LOG_NAME || undefined, level: process.env.LOG_LEVEL || "info", serializers: {
35
- err: (error) => ((0, exports.isAxiosError)(error) ? (0, exports.axiosErrorSerializer)(error) : pino_1.default.stdSerializers.err(error)),
36
- error: (error) => ((0, exports.isAxiosError)(error) ? (0, exports.axiosErrorSerializer)(error) : pino_1.default.stdSerializers.err(error)),
37
- axiosError: exports.axiosErrorSerializer,
38
- }, transport: process.env.LOGTAIL
8
+ const axiosErrorSerializer_1 = require("./axiosErrorSerializer");
9
+ const isAxiosError_1 = require("./isAxiosError");
10
+ exports.logger = (0, pino_1.default)({
11
+ name: process.env.LOG_NAME || undefined,
12
+ level: process.env.LOG_LEVEL || "info",
13
+ serializers: {
14
+ err: (error) => ((0, isAxiosError_1.isAxiosError)(error) ? (0, axiosErrorSerializer_1.axiosErrorSerializer)(error) : pino_1.default.stdSerializers.err(error)),
15
+ error: (error) => ((0, isAxiosError_1.isAxiosError)(error) ? (0, axiosErrorSerializer_1.axiosErrorSerializer)(error) : pino_1.default.stdSerializers.err(error)),
16
+ axiosError: axiosErrorSerializer_1.axiosErrorSerializer,
17
+ },
18
+ transport: process.env.LOGTAIL
39
19
  ? pino_1.default.transport({
40
20
  target: "@logtail/pino",
41
21
  options: { sourceToken: process.env.LOGTAIL },
42
22
  })
43
- : undefined }, (process.env.LOG_PID_AND_HOSTNAME ? {} : { base: undefined })), process.env.LOG_DESTINATION
23
+ : {
24
+ target: "pino-pretty",
25
+ options: {
26
+ colorize: true,
27
+ ignore: "pid,hostname",
28
+ translateTime: "yyyy-mm-dd HH:MM:ss",
29
+ },
30
+ },
31
+ }, process.env.LOG_DESTINATION
44
32
  ? pino_1.default.destination({
45
33
  dest: process.env.LOG_DESTINATION,
46
34
  sync: !!process.env.LOG_DESTINATION,
@@ -48,4 +36,4 @@ const logger = (0, pino_1.default)(Object.assign({ name: process.env.LOG_NAME ||
48
36
  : process.env.LOG_SYNC
49
37
  ? pino_1.default.destination({ sync: true })
50
38
  : pino_1.default.destination(1));
51
- exports.default = logger;
39
+ exports.default = exports.logger;