hb-smart-logger 1.0.6 → 1.0.7

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/package.json +1 -1
  2. package/src/index.js +8 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hb-smart-logger",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Production-ready Winston logger with daily rotation, safe JSON handling, and logger.log() alias",
5
5
  "main": "src/index.js",
6
6
  "publishConfig": {
package/src/index.js CHANGED
@@ -12,6 +12,8 @@ const DailyRotateFile = require("winston-daily-rotate-file");
12
12
 
13
13
  // Explicit debug opt-in
14
14
  const DEBUG_ENABLED = String(process.env.DEBUG).toLowerCase() === "true";
15
+ const FILE_SIZE = String(process.env.LOG_FILE_SIZE).toLowerCase() === "50m";
16
+ const FILE_TIME = String(process.env.LOG_FILE_TIME).toLowerCase() === "30d";
15
17
 
16
18
  // Ensure logs directory exists
17
19
  const logDir = path.resolve("logs");
@@ -89,8 +91,8 @@ baseLogger.add(
89
91
  level: DEBUG_ENABLED ? "debug" : "info",
90
92
  datePattern: "YYYY-MM-DD",
91
93
  zippedArchive: true,
92
- maxSize: "10m",
93
- maxFiles: "30d",
94
+ maxSize: FILE_SIZE,
95
+ maxFiles: FILE_TIME,
94
96
  })
95
97
  );
96
98
 
@@ -103,8 +105,8 @@ baseLogger.add(
103
105
  level,
104
106
  datePattern: "YYYY-MM-DD",
105
107
  zippedArchive: true,
106
- maxSize: "10m",
107
- maxFiles: "30d",
108
+ maxSize: FILE_SIZE,
109
+ maxFiles: FILE_TIME,
108
110
  })
109
111
  );
110
112
  });
@@ -118,8 +120,8 @@ if (DEBUG_ENABLED) {
118
120
  level: "debug",
119
121
  datePattern: "YYYY-MM-DD",
120
122
  zippedArchive: true,
121
- maxSize: "10m",
122
- maxFiles: "30d",
123
+ maxSize: FILE_SIZE,
124
+ maxFiles: FILE_TIME,
123
125
  })
124
126
  );
125
127
  }