@autofleet/logger 1.3.0-beta → 1.3.0-beta-2
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/index.js +10 -10
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const winston = require('winston');
|
|
2
|
-
const sizeof = require('object-sizeof');
|
|
2
|
+
// const sizeof = require('object-sizeof');
|
|
3
3
|
|
|
4
4
|
const { createLogger } = winston;
|
|
5
5
|
require('dotenv').config();
|
|
@@ -27,14 +27,14 @@ const getLevel = (logLevel) => {
|
|
|
27
27
|
return 'debug';
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
const addLogsSize = winston.format((info) => {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
// const addLogsSize = winston.format((info) => {
|
|
31
|
+
// const logSize = sizeof(info);
|
|
32
|
+
// if (logSize > 256000) {
|
|
33
|
+
// console.log(`[WARNING] Found Oversized log with message "${info.message}"`);
|
|
34
|
+
// }
|
|
35
35
|
|
|
36
|
-
|
|
37
|
-
});
|
|
36
|
+
// return { ...info, logSize };
|
|
37
|
+
// });
|
|
38
38
|
|
|
39
39
|
const enumerateErrorFormat = winston.format((info) => {
|
|
40
40
|
// fix for this crap: https://github.com/googleapis/nodejs-logging-winston/issues/285
|
|
@@ -68,14 +68,14 @@ const enumerateErrorFormat = winston.format((info) => {
|
|
|
68
68
|
const getFormat = () => {
|
|
69
69
|
if (isProd) {
|
|
70
70
|
return winston.format.combine(
|
|
71
|
-
addLogsSize(),
|
|
71
|
+
// addLogsSize(),
|
|
72
72
|
enumerateErrorFormat(),
|
|
73
73
|
winston.format.json(),
|
|
74
74
|
);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
return winston.format.combine(
|
|
78
|
-
addLogsSize(),
|
|
78
|
+
// addLogsSize(),
|
|
79
79
|
enumerateErrorFormat(),
|
|
80
80
|
winston.format.splat(),
|
|
81
81
|
winston.format.simple(),
|