@strapi/logger 5.12.0 → 5.12.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/dist/configs/default-configuration.js +21 -0
- package/dist/configs/default-configuration.js.map +1 -0
- package/dist/configs/default-configuration.mjs +19 -0
- package/dist/configs/default-configuration.mjs.map +1 -0
- package/dist/configs/index.js +10 -0
- package/dist/configs/index.js.map +1 -0
- package/dist/configs/index.mjs +3 -0
- package/dist/configs/index.mjs.map +1 -0
- package/dist/configs/output-file-configuration.js +27 -0
- package/dist/configs/output-file-configuration.js.map +1 -0
- package/dist/configs/output-file-configuration.mjs +25 -0
- package/dist/configs/output-file-configuration.mjs.map +1 -0
- package/dist/constants.js +11 -0
- package/dist/constants.js.map +1 -0
- package/dist/constants.mjs +8 -0
- package/dist/constants.mjs.map +1 -0
- package/dist/formats/detailed-log.js +18 -0
- package/dist/formats/detailed-log.js.map +1 -0
- package/dist/formats/detailed-log.mjs +16 -0
- package/dist/formats/detailed-log.mjs.map +1 -0
- package/dist/formats/exclude-colors.js +17 -0
- package/dist/formats/exclude-colors.js.map +1 -0
- package/dist/formats/exclude-colors.mjs +15 -0
- package/dist/formats/exclude-colors.mjs.map +1 -0
- package/dist/formats/index.js +14 -0
- package/dist/formats/index.js.map +1 -0
- package/dist/formats/index.mjs +5 -0
- package/dist/formats/index.mjs.map +1 -0
- package/dist/formats/level-filter.js +10 -0
- package/dist/formats/level-filter.js.map +1 -0
- package/dist/formats/level-filter.mjs +8 -0
- package/dist/formats/level-filter.mjs.map +1 -0
- package/dist/formats/log-errors.js +16 -0
- package/dist/formats/log-errors.js.map +1 -0
- package/dist/formats/log-errors.mjs +14 -0
- package/dist/formats/log-errors.mjs.map +1 -0
- package/dist/formats/pretty-print.js +29 -0
- package/dist/formats/pretty-print.js.map +1 -0
- package/dist/formats/pretty-print.mjs +27 -0
- package/dist/formats/pretty-print.mjs.map +1 -0
- package/dist/index.js +4 -106
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var winston = require('winston');
|
|
4
|
+
var constants = require('../constants.js');
|
|
5
|
+
var prettyPrint = require('../formats/pretty-print.js');
|
|
6
|
+
require('../formats/exclude-colors.js');
|
|
7
|
+
require('../formats/detailed-log.js');
|
|
8
|
+
|
|
9
|
+
var defaultConfiguration = (()=>{
|
|
10
|
+
return {
|
|
11
|
+
level: constants.LEVEL_LABEL,
|
|
12
|
+
levels: constants.LEVELS,
|
|
13
|
+
format: prettyPrint(),
|
|
14
|
+
transports: [
|
|
15
|
+
new winston.transports.Console()
|
|
16
|
+
]
|
|
17
|
+
};
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
module.exports = defaultConfiguration;
|
|
21
|
+
//# sourceMappingURL=default-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-configuration.js","sources":["../../src/configs/default-configuration.ts"],"sourcesContent":["import { transports, LoggerOptions } from 'winston';\nimport { LEVEL_LABEL, LEVELS } from '../constants';\nimport { prettyPrint } from '../formats';\n\nexport default (): LoggerOptions => {\n return {\n level: LEVEL_LABEL,\n levels: LEVELS,\n format: prettyPrint(),\n transports: [new transports.Console()],\n };\n};\n"],"names":["level","LEVEL_LABEL","levels","LEVELS","format","prettyPrint","transports","Console"],"mappings":";;;;;;;;AAIA,2BAAe,CAAA,IAAA;IACb,OAAO;QACLA,KAAOC,EAAAA,qBAAAA;QACPC,MAAQC,EAAAA,gBAAAA;QACRC,MAAQC,EAAAA,WAAAA,EAAAA;QACRC,UAAY,EAAA;AAAC,YAAA,IAAIA,mBAAWC,OAAO;AAAG;AACxC,KAAA;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { transports } from 'winston';
|
|
2
|
+
import { LEVEL_LABEL, LEVELS } from '../constants.mjs';
|
|
3
|
+
import prettyPrint from '../formats/pretty-print.mjs';
|
|
4
|
+
import '../formats/exclude-colors.mjs';
|
|
5
|
+
import '../formats/detailed-log.mjs';
|
|
6
|
+
|
|
7
|
+
var defaultConfiguration = (()=>{
|
|
8
|
+
return {
|
|
9
|
+
level: LEVEL_LABEL,
|
|
10
|
+
levels: LEVELS,
|
|
11
|
+
format: prettyPrint(),
|
|
12
|
+
transports: [
|
|
13
|
+
new transports.Console()
|
|
14
|
+
]
|
|
15
|
+
};
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
export { defaultConfiguration as default };
|
|
19
|
+
//# sourceMappingURL=default-configuration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default-configuration.mjs","sources":["../../src/configs/default-configuration.ts"],"sourcesContent":["import { transports, LoggerOptions } from 'winston';\nimport { LEVEL_LABEL, LEVELS } from '../constants';\nimport { prettyPrint } from '../formats';\n\nexport default (): LoggerOptions => {\n return {\n level: LEVEL_LABEL,\n levels: LEVELS,\n format: prettyPrint(),\n transports: [new transports.Console()],\n };\n};\n"],"names":["level","LEVEL_LABEL","levels","LEVELS","format","prettyPrint","transports","Console"],"mappings":";;;;;;AAIA,2BAAe,CAAA,IAAA;IACb,OAAO;QACLA,KAAOC,EAAAA,WAAAA;QACPC,MAAQC,EAAAA,MAAAA;QACRC,MAAQC,EAAAA,WAAAA,EAAAA;QACRC,UAAY,EAAA;AAAC,YAAA,IAAIA,WAAWC,OAAO;AAAG;AACxC,KAAA;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var defaultConfiguration = require('./default-configuration.js');
|
|
4
|
+
var outputFileConfiguration = require('./output-file-configuration.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
exports.createDefaultConfiguration = defaultConfiguration;
|
|
9
|
+
exports.createOutputFileConfiguration = outputFileConfiguration;
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var winston = require('winston');
|
|
4
|
+
var constants = require('../constants.js');
|
|
5
|
+
var prettyPrint = require('../formats/pretty-print.js');
|
|
6
|
+
var excludeColors = require('../formats/exclude-colors.js');
|
|
7
|
+
require('../formats/detailed-log.js');
|
|
8
|
+
|
|
9
|
+
var outputFileConfiguration = ((filename, fileTransportOptions = {})=>{
|
|
10
|
+
return {
|
|
11
|
+
level: constants.LEVEL_LABEL,
|
|
12
|
+
levels: constants.LEVELS,
|
|
13
|
+
format: prettyPrint(),
|
|
14
|
+
transports: [
|
|
15
|
+
new winston.transports.Console(),
|
|
16
|
+
new winston.transports.File({
|
|
17
|
+
level: 'error',
|
|
18
|
+
filename,
|
|
19
|
+
format: excludeColors,
|
|
20
|
+
...fileTransportOptions
|
|
21
|
+
})
|
|
22
|
+
]
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
module.exports = outputFileConfiguration;
|
|
27
|
+
//# sourceMappingURL=output-file-configuration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-file-configuration.js","sources":["../../src/configs/output-file-configuration.ts"],"sourcesContent":["import { transports, LoggerOptions } from 'winston';\n\nimport { LEVEL_LABEL, LEVELS } from '../constants';\nimport { prettyPrint, excludeColors } from '../formats';\n\nexport default (\n filename: string,\n fileTransportOptions: transports.FileTransportOptions = {}\n): LoggerOptions => {\n return {\n level: LEVEL_LABEL,\n levels: LEVELS,\n format: prettyPrint(),\n transports: [\n new transports.Console(),\n new transports.File({\n level: 'error',\n filename,\n format: excludeColors,\n ...fileTransportOptions,\n }),\n ],\n };\n};\n"],"names":["filename","fileTransportOptions","level","LEVEL_LABEL","levels","LEVELS","format","prettyPrint","transports","Console","File","excludeColors"],"mappings":";;;;;;;;AAKA,8BAAe,CAAA,CACbA,QACAC,EAAAA,oBAAAA,GAAwD,EAAE,GAAA;IAE1D,OAAO;QACLC,KAAOC,EAAAA,qBAAAA;QACPC,MAAQC,EAAAA,gBAAAA;QACRC,MAAQC,EAAAA,WAAAA,EAAAA;QACRC,UAAY,EAAA;AACV,YAAA,IAAIA,mBAAWC,OAAO,EAAA;YACtB,IAAID,kBAAAA,CAAWE,IAAI,CAAC;gBAClBR,KAAO,EAAA,OAAA;AACPF,gBAAAA,QAAAA;gBACAM,MAAQK,EAAAA,aAAAA;AACR,gBAAA,GAAGV;AACL,aAAA;AACD;AACH,KAAA;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { transports } from 'winston';
|
|
2
|
+
import { LEVEL_LABEL, LEVELS } from '../constants.mjs';
|
|
3
|
+
import prettyPrint from '../formats/pretty-print.mjs';
|
|
4
|
+
import excludeColors from '../formats/exclude-colors.mjs';
|
|
5
|
+
import '../formats/detailed-log.mjs';
|
|
6
|
+
|
|
7
|
+
var outputFileConfiguration = ((filename, fileTransportOptions = {})=>{
|
|
8
|
+
return {
|
|
9
|
+
level: LEVEL_LABEL,
|
|
10
|
+
levels: LEVELS,
|
|
11
|
+
format: prettyPrint(),
|
|
12
|
+
transports: [
|
|
13
|
+
new transports.Console(),
|
|
14
|
+
new transports.File({
|
|
15
|
+
level: 'error',
|
|
16
|
+
filename,
|
|
17
|
+
format: excludeColors,
|
|
18
|
+
...fileTransportOptions
|
|
19
|
+
})
|
|
20
|
+
]
|
|
21
|
+
};
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
export { outputFileConfiguration as default };
|
|
25
|
+
//# sourceMappingURL=output-file-configuration.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output-file-configuration.mjs","sources":["../../src/configs/output-file-configuration.ts"],"sourcesContent":["import { transports, LoggerOptions } from 'winston';\n\nimport { LEVEL_LABEL, LEVELS } from '../constants';\nimport { prettyPrint, excludeColors } from '../formats';\n\nexport default (\n filename: string,\n fileTransportOptions: transports.FileTransportOptions = {}\n): LoggerOptions => {\n return {\n level: LEVEL_LABEL,\n levels: LEVELS,\n format: prettyPrint(),\n transports: [\n new transports.Console(),\n new transports.File({\n level: 'error',\n filename,\n format: excludeColors,\n ...fileTransportOptions,\n }),\n ],\n };\n};\n"],"names":["filename","fileTransportOptions","level","LEVEL_LABEL","levels","LEVELS","format","prettyPrint","transports","Console","File","excludeColors"],"mappings":";;;;;;AAKA,8BAAe,CAAA,CACbA,QACAC,EAAAA,oBAAAA,GAAwD,EAAE,GAAA;IAE1D,OAAO;QACLC,KAAOC,EAAAA,WAAAA;QACPC,MAAQC,EAAAA,MAAAA;QACRC,MAAQC,EAAAA,WAAAA,EAAAA;QACRC,UAAY,EAAA;AACV,YAAA,IAAIA,WAAWC,OAAO,EAAA;YACtB,IAAID,UAAAA,CAAWE,IAAI,CAAC;gBAClBR,KAAO,EAAA,OAAA;AACPF,gBAAAA,QAAAA;gBACAM,MAAQK,EAAAA,aAAAA;AACR,gBAAA,GAAGV;AACL,aAAA;AACD;AACH,KAAA;AACF,CAAA;;;;"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var winston = require('winston');
|
|
4
|
+
|
|
5
|
+
const LEVELS = winston.config.npm.levels;
|
|
6
|
+
const LEVEL_LABEL = 'silly';
|
|
7
|
+
LEVELS[LEVEL_LABEL];
|
|
8
|
+
|
|
9
|
+
exports.LEVELS = LEVELS;
|
|
10
|
+
exports.LEVEL_LABEL = LEVEL_LABEL;
|
|
11
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../src/constants.ts"],"sourcesContent":["import { config } from 'winston';\n\nconst LEVELS = config.npm.levels;\nconst LEVEL_LABEL = 'silly';\nconst LEVEL = LEVELS[LEVEL_LABEL];\n\nexport { LEVEL, LEVEL_LABEL, LEVELS };\n"],"names":["LEVELS","config","npm","levels","LEVEL_LABEL"],"mappings":";;;;AAEA,MAAMA,MAASC,GAAAA,cAAAA,CAAOC,GAAG,CAACC;AAC1B,MAAMC,WAAc,GAAA;AACNJ,MAAM,CAACI,WAAY;;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","sources":["../src/constants.ts"],"sourcesContent":["import { config } from 'winston';\n\nconst LEVELS = config.npm.levels;\nconst LEVEL_LABEL = 'silly';\nconst LEVEL = LEVELS[LEVEL_LABEL];\n\nexport { LEVEL, LEVEL_LABEL, LEVELS };\n"],"names":["LEVELS","config","npm","levels","LEVEL_LABEL"],"mappings":";;AAEA,MAAMA,MAASC,GAAAA,MAAAA,CAAOC,GAAG,CAACC;AAC1B,MAAMC,WAAc,GAAA;AACNJ,MAAM,CAACI,WAAY;;;;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var winston = require('winston');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This will remove the chalk color codes from the message provided.
|
|
7
|
+
* It's used to log plain text in the log file
|
|
8
|
+
*/ var detailedLog = winston.format.printf(({ message, level, timestamp })=>{
|
|
9
|
+
if (typeof message !== 'string') {
|
|
10
|
+
return message;
|
|
11
|
+
}
|
|
12
|
+
const newMessage = `[${timestamp}] ${level}: ${message}`;
|
|
13
|
+
return newMessage.replace(// eslint-disable-next-line no-control-regex
|
|
14
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
module.exports = detailedLog;
|
|
18
|
+
//# sourceMappingURL=detailed-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detailed-log.js","sources":["../../src/formats/detailed-log.ts"],"sourcesContent":["import { format } from 'winston';\n\n/**\n * This will remove the chalk color codes from the message provided.\n * It's used to log plain text in the log file\n */\nexport default format.printf(({ message, level, timestamp }) => {\n if (typeof message !== 'string') {\n return message;\n }\n\n const newMessage = `[${timestamp as string}] ${level}: ${message as string}`;\n\n return newMessage.replace(\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,\n ''\n );\n});\n"],"names":["format","printf","message","level","timestamp","newMessage","replace"],"mappings":";;;;AAEA;;;IAIA,kBAAeA,cAAOC,CAAAA,MAAM,CAAC,CAAC,EAAEC,OAAO,EAAEC,KAAK,EAAEC,SAAS,EAAE,GAAA;IACzD,IAAI,OAAOF,YAAY,QAAU,EAAA;QAC/B,OAAOA,OAAAA;AACT;IAEA,MAAMG,UAAAA,GAAa,CAAC,CAAC,EAAED,SAAAA,CAAoB,EAAE,EAAED,KAAM,CAAA,EAAE,EAAED,OAAAA,CAAkB,CAAC;IAE5E,OAAOG,UAAAA,CAAWC,OAAO;IAEvB,6EACA,EAAA,EAAA,CAAA;AAEJ,CAAG,CAAA;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { format } from 'winston';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This will remove the chalk color codes from the message provided.
|
|
5
|
+
* It's used to log plain text in the log file
|
|
6
|
+
*/ var detailedLog = format.printf(({ message, level, timestamp })=>{
|
|
7
|
+
if (typeof message !== 'string') {
|
|
8
|
+
return message;
|
|
9
|
+
}
|
|
10
|
+
const newMessage = `[${timestamp}] ${level}: ${message}`;
|
|
11
|
+
return newMessage.replace(// eslint-disable-next-line no-control-regex
|
|
12
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
export { detailedLog as default };
|
|
16
|
+
//# sourceMappingURL=detailed-log.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detailed-log.mjs","sources":["../../src/formats/detailed-log.ts"],"sourcesContent":["import { format } from 'winston';\n\n/**\n * This will remove the chalk color codes from the message provided.\n * It's used to log plain text in the log file\n */\nexport default format.printf(({ message, level, timestamp }) => {\n if (typeof message !== 'string') {\n return message;\n }\n\n const newMessage = `[${timestamp as string}] ${level}: ${message as string}`;\n\n return newMessage.replace(\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,\n ''\n );\n});\n"],"names":["format","printf","message","level","timestamp","newMessage","replace"],"mappings":";;AAEA;;;IAIA,kBAAeA,MAAOC,CAAAA,MAAM,CAAC,CAAC,EAAEC,OAAO,EAAEC,KAAK,EAAEC,SAAS,EAAE,GAAA;IACzD,IAAI,OAAOF,YAAY,QAAU,EAAA;QAC/B,OAAOA,OAAAA;AACT;IAEA,MAAMG,UAAAA,GAAa,CAAC,CAAC,EAAED,SAAAA,CAAoB,EAAE,EAAED,KAAM,CAAA,EAAE,EAAED,OAAAA,CAAkB,CAAC;IAE5E,OAAOG,UAAAA,CAAWC,OAAO;IAEvB,6EACA,EAAA,EAAA,CAAA;AAEJ,CAAG,CAAA;;;;"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var winston = require('winston');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* This will remove the chalk color codes from the message provided.
|
|
7
|
+
* It's used to log plain text in the log file
|
|
8
|
+
*/ var excludeColors = winston.format.printf(({ message })=>{
|
|
9
|
+
if (typeof message !== 'string') {
|
|
10
|
+
return message;
|
|
11
|
+
}
|
|
12
|
+
return message.replace(// eslint-disable-next-line no-control-regex
|
|
13
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
module.exports = excludeColors;
|
|
17
|
+
//# sourceMappingURL=exclude-colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclude-colors.js","sources":["../../src/formats/exclude-colors.ts"],"sourcesContent":["import { format } from 'winston';\n\n/**\n * This will remove the chalk color codes from the message provided.\n * It's used to log plain text in the log file\n */\nexport default format.printf(({ message }) => {\n if (typeof message !== 'string') {\n return message;\n }\n\n return message.replace(\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,\n ''\n );\n});\n"],"names":["format","printf","message","replace"],"mappings":";;;;AAEA;;;AAGC,IACD,oBAAeA,cAAOC,CAAAA,MAAM,CAAC,CAAC,EAAEC,OAAO,EAAE,GAAA;IACvC,IAAI,OAAOA,YAAY,QAAU,EAAA;QAC/B,OAAOA,OAAAA;AACT;IAEA,OAAOA,OAAAA,CAAQC,OAAO;IAEpB,6EACA,EAAA,EAAA,CAAA;AAEJ,CAAG,CAAA;;;;"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { format } from 'winston';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This will remove the chalk color codes from the message provided.
|
|
5
|
+
* It's used to log plain text in the log file
|
|
6
|
+
*/ var excludeColors = format.printf(({ message })=>{
|
|
7
|
+
if (typeof message !== 'string') {
|
|
8
|
+
return message;
|
|
9
|
+
}
|
|
10
|
+
return message.replace(// eslint-disable-next-line no-control-regex
|
|
11
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export { excludeColors as default };
|
|
15
|
+
//# sourceMappingURL=exclude-colors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exclude-colors.mjs","sources":["../../src/formats/exclude-colors.ts"],"sourcesContent":["import { format } from 'winston';\n\n/**\n * This will remove the chalk color codes from the message provided.\n * It's used to log plain text in the log file\n */\nexport default format.printf(({ message }) => {\n if (typeof message !== 'string') {\n return message;\n }\n\n return message.replace(\n // eslint-disable-next-line no-control-regex\n /[\\u001b\\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g,\n ''\n );\n});\n"],"names":["format","printf","message","replace"],"mappings":";;AAEA;;;AAGC,IACD,oBAAeA,MAAOC,CAAAA,MAAM,CAAC,CAAC,EAAEC,OAAO,EAAE,GAAA;IACvC,IAAI,OAAOA,YAAY,QAAU,EAAA;QAC/B,OAAOA,OAAAA;AACT;IAEA,OAAOA,OAAAA,CAAQC,OAAO;IAEpB,6EACA,EAAA,EAAA,CAAA;AAEJ,CAAG,CAAA;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var prettyPrint = require('./pretty-print.js');
|
|
4
|
+
var levelFilter = require('./level-filter.js');
|
|
5
|
+
var excludeColors = require('./exclude-colors.js');
|
|
6
|
+
var detailedLog = require('./detailed-log.js');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.prettyPrint = prettyPrint;
|
|
11
|
+
exports.levelFilter = levelFilter;
|
|
12
|
+
exports.excludeColors = excludeColors;
|
|
13
|
+
exports.detailedLogs = detailedLog;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { default as prettyPrint } from './pretty-print.mjs';
|
|
2
|
+
export { default as levelFilter } from './level-filter.mjs';
|
|
3
|
+
export { default as excludeColors } from './exclude-colors.mjs';
|
|
4
|
+
export { default as detailedLogs } from './detailed-log.mjs';
|
|
5
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var winston = require('winston');
|
|
4
|
+
|
|
5
|
+
var levelFilter = ((...levels)=>{
|
|
6
|
+
return winston.format((info)=>levels.some((level)=>info.level.includes(level)) ? info : false)();
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
module.exports = levelFilter;
|
|
10
|
+
//# sourceMappingURL=level-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"level-filter.js","sources":["../../src/formats/level-filter.ts"],"sourcesContent":["import { format } from 'winston';\n\nexport default (...levels: string[]) => {\n return format((info) => (levels.some((level) => info.level.includes(level)) ? info : false))();\n};\n"],"names":["levels","format","info","some","level","includes"],"mappings":";;;;AAEA,kBAAe,CAAA,CAAC,GAAGA,MAAAA,GAAAA;AACjB,IAAA,OAAOC,cAAO,CAAA,CAACC,IAAUF,GAAAA,MAAAA,CAAOG,IAAI,CAAC,CAACC,KAAUF,GAAAA,IAAAA,CAAKE,KAAK,CAACC,QAAQ,CAACD,UAAUF,IAAO,GAAA,KAAA,CAAA,EAAA;AACvF,CAAA;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"level-filter.mjs","sources":["../../src/formats/level-filter.ts"],"sourcesContent":["import { format } from 'winston';\n\nexport default (...levels: string[]) => {\n return format((info) => (levels.some((level) => info.level.includes(level)) ? info : false))();\n};\n"],"names":["levels","format","info","some","level","includes"],"mappings":";;AAEA,kBAAe,CAAA,CAAC,GAAGA,MAAAA,GAAAA;AACjB,IAAA,OAAOC,MAAO,CAAA,CAACC,IAAUF,GAAAA,MAAAA,CAAOG,IAAI,CAAC,CAACC,KAAUF,GAAAA,IAAAA,CAAKE,KAAK,CAACC,QAAQ,CAACD,UAAUF,IAAO,GAAA,KAAA,CAAA,EAAA;AACvF,CAAA;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var winston = require('winston');
|
|
4
|
+
|
|
5
|
+
const logErrors = winston.format((info)=>{
|
|
6
|
+
if (info instanceof Error) {
|
|
7
|
+
return {
|
|
8
|
+
...info,
|
|
9
|
+
message: `${info.message}${info.stack ? `\n${info.stack}` : ''}`
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return info;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
module.exports = logErrors;
|
|
16
|
+
//# sourceMappingURL=log-errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-errors.js","sources":["../../src/formats/log-errors.ts"],"sourcesContent":["import { format, Logform } from 'winston';\n\nconst logErrors: Logform.FormatWrap = format((info) => {\n if (info instanceof Error) {\n return { ...info, message: `${info.message as string}${info.stack ? `\\n${info.stack}` : ''}` };\n }\n\n return info;\n});\n\nexport default logErrors;\n"],"names":["logErrors","format","info","Error","message","stack"],"mappings":";;;;AAEMA,MAAAA,SAAAA,GAAgCC,eAAO,CAACC,IAAAA,GAAAA;AAC5C,IAAA,IAAIA,gBAAgBC,KAAO,EAAA;QACzB,OAAO;AAAE,YAAA,GAAGD,IAAI;AAAEE,YAAAA,OAAAA,EAAS,CAAC,EAAEF,IAAAA,CAAKE,OAAO,CAAW,EAAEF,KAAKG,KAAK,GAAG,CAAC,EAAE,EAAEH,IAAKG,CAAAA,KAAK,CAAC,CAAC,GAAG,GAAG;AAAE,SAAA;AAC/F;IAEA,OAAOH,IAAAA;AACT,CAAA;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { format } from 'winston';
|
|
2
|
+
|
|
3
|
+
const logErrors = format((info)=>{
|
|
4
|
+
if (info instanceof Error) {
|
|
5
|
+
return {
|
|
6
|
+
...info,
|
|
7
|
+
message: `${info.message}${info.stack ? `\n${info.stack}` : ''}`
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
return info;
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export { logErrors as default };
|
|
14
|
+
//# sourceMappingURL=log-errors.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"log-errors.mjs","sources":["../../src/formats/log-errors.ts"],"sourcesContent":["import { format, Logform } from 'winston';\n\nconst logErrors: Logform.FormatWrap = format((info) => {\n if (info instanceof Error) {\n return { ...info, message: `${info.message as string}${info.stack ? `\\n${info.stack}` : ''}` };\n }\n\n return info;\n});\n\nexport default logErrors;\n"],"names":["logErrors","format","info","Error","message","stack"],"mappings":";;AAEMA,MAAAA,SAAAA,GAAgCC,OAAO,CAACC,IAAAA,GAAAA;AAC5C,IAAA,IAAIA,gBAAgBC,KAAO,EAAA;QACzB,OAAO;AAAE,YAAA,GAAGD,IAAI;AAAEE,YAAAA,OAAAA,EAAS,CAAC,EAAEF,IAAAA,CAAKE,OAAO,CAAW,EAAEF,KAAKG,KAAK,GAAG,CAAC,EAAE,EAAEH,IAAKG,CAAAA,KAAK,CAAC,CAAC,GAAG,GAAG;AAAE,SAAA;AAC/F;IAEA,OAAOH,IAAAA;AACT,CAAA;;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var winston = require('winston');
|
|
4
|
+
var logErrors = require('./log-errors.js');
|
|
5
|
+
|
|
6
|
+
const defaultTimestampFormat = 'YYYY-MM-DD HH:mm:ss.SSS';
|
|
7
|
+
/**
|
|
8
|
+
* Create a pretty print formatter for a winston logger
|
|
9
|
+
* @param options
|
|
10
|
+
*/ var prettyPrint = ((options = {})=>{
|
|
11
|
+
const { timestamps = true, colors = true } = options;
|
|
12
|
+
const handlers = [];
|
|
13
|
+
if (timestamps) {
|
|
14
|
+
handlers.push(winston.format.timestamp({
|
|
15
|
+
format: timestamps === true ? defaultTimestampFormat : timestamps
|
|
16
|
+
}));
|
|
17
|
+
}
|
|
18
|
+
if (colors) {
|
|
19
|
+
handlers.push(winston.format.colorize());
|
|
20
|
+
}
|
|
21
|
+
handlers.push(logErrors());
|
|
22
|
+
handlers.push(winston.format.printf(({ level, message, timestamp })=>{
|
|
23
|
+
return `${timestamps ? `[${timestamp}] ` : ''}${level}: ${message}`;
|
|
24
|
+
}));
|
|
25
|
+
return winston.format.combine(...handlers);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
module.exports = prettyPrint;
|
|
29
|
+
//# sourceMappingURL=pretty-print.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty-print.js","sources":["../../src/formats/pretty-print.ts"],"sourcesContent":["import { format, Logform } from 'winston';\nimport logErrors from './log-errors';\n\nconst defaultTimestampFormat = 'YYYY-MM-DD HH:mm:ss.SSS';\n\nexport interface PrettyPrintOptions {\n /**\n * Enable or disable timestamps print if it's a boolean value. Use the given format for the timestamps if it's a string\n */\n timestamps?: Logform.TimestampOptions['format'] | boolean;\n /**\n * Enable or disable the use of colors for the log level\n */\n colors?: boolean;\n}\n\n/**\n * Create a pretty print formatter for a winston logger\n * @param options\n */\nexport default (options: PrettyPrintOptions = {}): Logform.Format => {\n const { timestamps = true, colors = true } = options;\n\n const handlers: Logform.Format[] = [];\n\n if (timestamps) {\n handlers.push(\n format.timestamp({\n format: timestamps === true ? defaultTimestampFormat : timestamps,\n })\n );\n }\n\n if (colors) {\n handlers.push(format.colorize());\n }\n\n handlers.push(logErrors());\n\n handlers.push(\n format.printf(({ level, message, timestamp }) => {\n return `${timestamps ? `[${timestamp as string}] ` : ''}${level}: ${message as string}`;\n })\n );\n\n return format.combine(...handlers);\n};\n"],"names":["defaultTimestampFormat","options","timestamps","colors","handlers","push","format","timestamp","colorize","logErrors","printf","level","message","combine"],"mappings":";;;;;AAGA,MAAMA,sBAAyB,GAAA,yBAAA;AAa/B;;;AAGC,IACD,kBAAe,CAAA,CAACC,OAAAA,GAA8B,EAAE,GAAA;AAC9C,IAAA,MAAM,EAAEC,UAAa,GAAA,IAAI,EAAEC,MAAS,GAAA,IAAI,EAAE,GAAGF,OAAAA;AAE7C,IAAA,MAAMG,WAA6B,EAAE;AAErC,IAAA,IAAIF,UAAY,EAAA;AACdE,QAAAA,QAAAA,CAASC,IAAI,CACXC,cAAOC,CAAAA,SAAS,CAAC;YACfD,MAAQJ,EAAAA,UAAAA,KAAe,OAAOF,sBAAyBE,GAAAA;AACzD,SAAA,CAAA,CAAA;AAEJ;AAEA,IAAA,IAAIC,MAAQ,EAAA;QACVC,QAASC,CAAAA,IAAI,CAACC,cAAAA,CAAOE,QAAQ,EAAA,CAAA;AAC/B;AAEAJ,IAAAA,QAAAA,CAASC,IAAI,CAACI,SAAAA,EAAAA,CAAAA;AAEdL,IAAAA,QAAAA,CAASC,IAAI,CACXC,cAAOI,CAAAA,MAAM,CAAC,CAAC,EAAEC,KAAK,EAAEC,OAAO,EAAEL,SAAS,EAAE,GAAA;AAC1C,QAAA,OAAO,CAAC,EAAEL,UAAAA,GAAa,CAAC,CAAC,EAAEK,SAAoB,CAAA,EAAE,CAAC,GAAG,GAAG,EAAEI,KAAAA,CAAM,EAAE,EAAEC,QAAkB,CAAC;AACzF,KAAA,CAAA,CAAA;IAGF,OAAON,cAAAA,CAAOO,OAAO,CAAIT,GAAAA,QAAAA,CAAAA;AAC3B,CAAA;;;;"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { format } from 'winston';
|
|
2
|
+
import logErrors from './log-errors.mjs';
|
|
3
|
+
|
|
4
|
+
const defaultTimestampFormat = 'YYYY-MM-DD HH:mm:ss.SSS';
|
|
5
|
+
/**
|
|
6
|
+
* Create a pretty print formatter for a winston logger
|
|
7
|
+
* @param options
|
|
8
|
+
*/ var prettyPrint = ((options = {})=>{
|
|
9
|
+
const { timestamps = true, colors = true } = options;
|
|
10
|
+
const handlers = [];
|
|
11
|
+
if (timestamps) {
|
|
12
|
+
handlers.push(format.timestamp({
|
|
13
|
+
format: timestamps === true ? defaultTimestampFormat : timestamps
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
if (colors) {
|
|
17
|
+
handlers.push(format.colorize());
|
|
18
|
+
}
|
|
19
|
+
handlers.push(logErrors());
|
|
20
|
+
handlers.push(format.printf(({ level, message, timestamp })=>{
|
|
21
|
+
return `${timestamps ? `[${timestamp}] ` : ''}${level}: ${message}`;
|
|
22
|
+
}));
|
|
23
|
+
return format.combine(...handlers);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export { prettyPrint as default };
|
|
27
|
+
//# sourceMappingURL=pretty-print.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pretty-print.mjs","sources":["../../src/formats/pretty-print.ts"],"sourcesContent":["import { format, Logform } from 'winston';\nimport logErrors from './log-errors';\n\nconst defaultTimestampFormat = 'YYYY-MM-DD HH:mm:ss.SSS';\n\nexport interface PrettyPrintOptions {\n /**\n * Enable or disable timestamps print if it's a boolean value. Use the given format for the timestamps if it's a string\n */\n timestamps?: Logform.TimestampOptions['format'] | boolean;\n /**\n * Enable or disable the use of colors for the log level\n */\n colors?: boolean;\n}\n\n/**\n * Create a pretty print formatter for a winston logger\n * @param options\n */\nexport default (options: PrettyPrintOptions = {}): Logform.Format => {\n const { timestamps = true, colors = true } = options;\n\n const handlers: Logform.Format[] = [];\n\n if (timestamps) {\n handlers.push(\n format.timestamp({\n format: timestamps === true ? defaultTimestampFormat : timestamps,\n })\n );\n }\n\n if (colors) {\n handlers.push(format.colorize());\n }\n\n handlers.push(logErrors());\n\n handlers.push(\n format.printf(({ level, message, timestamp }) => {\n return `${timestamps ? `[${timestamp as string}] ` : ''}${level}: ${message as string}`;\n })\n );\n\n return format.combine(...handlers);\n};\n"],"names":["defaultTimestampFormat","options","timestamps","colors","handlers","push","format","timestamp","colorize","logErrors","printf","level","message","combine"],"mappings":";;;AAGA,MAAMA,sBAAyB,GAAA,yBAAA;AAa/B;;;AAGC,IACD,kBAAe,CAAA,CAACC,OAAAA,GAA8B,EAAE,GAAA;AAC9C,IAAA,MAAM,EAAEC,UAAa,GAAA,IAAI,EAAEC,MAAS,GAAA,IAAI,EAAE,GAAGF,OAAAA;AAE7C,IAAA,MAAMG,WAA6B,EAAE;AAErC,IAAA,IAAIF,UAAY,EAAA;AACdE,QAAAA,QAAAA,CAASC,IAAI,CACXC,MAAOC,CAAAA,SAAS,CAAC;YACfD,MAAQJ,EAAAA,UAAAA,KAAe,OAAOF,sBAAyBE,GAAAA;AACzD,SAAA,CAAA,CAAA;AAEJ;AAEA,IAAA,IAAIC,MAAQ,EAAA;QACVC,QAASC,CAAAA,IAAI,CAACC,MAAAA,CAAOE,QAAQ,EAAA,CAAA;AAC/B;AAEAJ,IAAAA,QAAAA,CAASC,IAAI,CAACI,SAAAA,EAAAA,CAAAA;AAEdL,IAAAA,QAAAA,CAASC,IAAI,CACXC,MAAOI,CAAAA,MAAM,CAAC,CAAC,EAAEC,KAAK,EAAEC,OAAO,EAAEL,SAAS,EAAE,GAAA;AAC1C,QAAA,OAAO,CAAC,EAAEL,UAAAA,GAAa,CAAC,CAAC,EAAEK,SAAoB,CAAA,EAAE,CAAC,GAAG,GAAG,EAAEI,KAAAA,CAAM,EAAE,EAAEC,QAAkB,CAAC;AACzF,KAAA,CAAA,CAAA;IAGF,OAAON,MAAAA,CAAOO,OAAO,CAAIT,GAAAA,QAAAA,CAAAA;AAC3B,CAAA;;;;"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var winston = require('winston');
|
|
4
|
+
var index = require('./configs/index.js');
|
|
5
|
+
var index$1 = require('./formats/index.js');
|
|
6
|
+
var defaultConfiguration = require('./configs/default-configuration.js');
|
|
4
7
|
|
|
5
8
|
function _interopNamespaceDefault(e) {
|
|
6
9
|
var n = Object.create(null);
|
|
@@ -21,111 +24,6 @@ function _interopNamespaceDefault(e) {
|
|
|
21
24
|
|
|
22
25
|
var winston__namespace = /*#__PURE__*/_interopNamespaceDefault(winston);
|
|
23
26
|
|
|
24
|
-
const LEVELS = winston.config.npm.levels;
|
|
25
|
-
const LEVEL_LABEL = 'silly';
|
|
26
|
-
LEVELS[LEVEL_LABEL];
|
|
27
|
-
|
|
28
|
-
const logErrors = winston.format((info)=>{
|
|
29
|
-
if (info instanceof Error) {
|
|
30
|
-
return {
|
|
31
|
-
...info,
|
|
32
|
-
message: `${info.message}${info.stack ? `\n${info.stack}` : ''}`
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
return info;
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
const defaultTimestampFormat = 'YYYY-MM-DD HH:mm:ss.SSS';
|
|
39
|
-
/**
|
|
40
|
-
* Create a pretty print formatter for a winston logger
|
|
41
|
-
* @param options
|
|
42
|
-
*/ var prettyPrint = ((options = {})=>{
|
|
43
|
-
const { timestamps = true, colors = true } = options;
|
|
44
|
-
const handlers = [];
|
|
45
|
-
if (timestamps) {
|
|
46
|
-
handlers.push(winston.format.timestamp({
|
|
47
|
-
format: timestamps === true ? defaultTimestampFormat : timestamps
|
|
48
|
-
}));
|
|
49
|
-
}
|
|
50
|
-
if (colors) {
|
|
51
|
-
handlers.push(winston.format.colorize());
|
|
52
|
-
}
|
|
53
|
-
handlers.push(logErrors());
|
|
54
|
-
handlers.push(winston.format.printf(({ level, message, timestamp })=>{
|
|
55
|
-
return `${timestamps ? `[${timestamp}] ` : ''}${level}: ${message}`;
|
|
56
|
-
}));
|
|
57
|
-
return winston.format.combine(...handlers);
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
var levelFilter = ((...levels)=>{
|
|
61
|
-
return winston.format((info)=>levels.some((level)=>info.level.includes(level)) ? info : false)();
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* This will remove the chalk color codes from the message provided.
|
|
66
|
-
* It's used to log plain text in the log file
|
|
67
|
-
*/ var excludeColors = winston.format.printf(({ message })=>{
|
|
68
|
-
if (typeof message !== 'string') {
|
|
69
|
-
return message;
|
|
70
|
-
}
|
|
71
|
-
return message.replace(// eslint-disable-next-line no-control-regex
|
|
72
|
-
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* This will remove the chalk color codes from the message provided.
|
|
77
|
-
* It's used to log plain text in the log file
|
|
78
|
-
*/ var detailedLog = winston.format.printf(({ message, level, timestamp })=>{
|
|
79
|
-
if (typeof message !== 'string') {
|
|
80
|
-
return message;
|
|
81
|
-
}
|
|
82
|
-
const newMessage = `[${timestamp}] ${level}: ${message}`;
|
|
83
|
-
return newMessage.replace(// eslint-disable-next-line no-control-regex
|
|
84
|
-
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
var index$1 = /*#__PURE__*/Object.freeze({
|
|
88
|
-
__proto__: null,
|
|
89
|
-
detailedLogs: detailedLog,
|
|
90
|
-
excludeColors: excludeColors,
|
|
91
|
-
levelFilter: levelFilter,
|
|
92
|
-
prettyPrint: prettyPrint
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
var defaultConfiguration = (()=>{
|
|
96
|
-
return {
|
|
97
|
-
level: LEVEL_LABEL,
|
|
98
|
-
levels: LEVELS,
|
|
99
|
-
format: prettyPrint(),
|
|
100
|
-
transports: [
|
|
101
|
-
new winston.transports.Console()
|
|
102
|
-
]
|
|
103
|
-
};
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
var outputFileConfiguration = ((filename, fileTransportOptions = {})=>{
|
|
107
|
-
return {
|
|
108
|
-
level: LEVEL_LABEL,
|
|
109
|
-
levels: LEVELS,
|
|
110
|
-
format: prettyPrint(),
|
|
111
|
-
transports: [
|
|
112
|
-
new winston.transports.Console(),
|
|
113
|
-
new winston.transports.File({
|
|
114
|
-
level: 'error',
|
|
115
|
-
filename,
|
|
116
|
-
format: excludeColors,
|
|
117
|
-
...fileTransportOptions
|
|
118
|
-
})
|
|
119
|
-
]
|
|
120
|
-
};
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
124
|
-
__proto__: null,
|
|
125
|
-
createDefaultConfiguration: defaultConfiguration,
|
|
126
|
-
createOutputFileConfiguration: outputFileConfiguration
|
|
127
|
-
});
|
|
128
|
-
|
|
129
27
|
const createLogger = (userConfiguration = {})=>{
|
|
130
28
|
const configuration = defaultConfiguration();
|
|
131
29
|
Object.assign(configuration, userConfiguration);
|
|
@@ -134,6 +32,6 @@ const createLogger = (userConfiguration = {})=>{
|
|
|
134
32
|
|
|
135
33
|
exports.winston = winston__namespace;
|
|
136
34
|
exports.configs = index;
|
|
137
|
-
exports.createLogger = createLogger;
|
|
138
35
|
exports.formats = index$1;
|
|
36
|
+
exports.createLogger = createLogger;
|
|
139
37
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import * as winston from 'winston';\nimport * as configs from './configs';\n\nexport * as formats from './formats';\n\nexport type Logger = winston.Logger;\n\nconst createLogger = (userConfiguration: winston.LoggerOptions = {}): winston.Logger => {\n const configuration = configs.createDefaultConfiguration();\n\n Object.assign(configuration, userConfiguration);\n\n return winston.createLogger(configuration);\n};\n\nexport { createLogger, winston, configs };\n"],"names":["createLogger","userConfiguration","configuration","configs","Object","assign","winston"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAMA,YAAe,GAAA,CAACC,iBAA2C,GAAA,EAAE,GAAA;IACjE,MAAMC,aAAAA,GAAgBC,oBAAkC,EAAA;IAExDC,MAAOC,CAAAA,MAAM,CAACH,aAAeD,EAAAA,iBAAAA,CAAAA;IAE7B,OAAOK,kBAAAA,CAAQN,YAAY,CAACE,aAAAA,CAAAA;AAC9B;;;;;;;"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,111 +1,10 @@
|
|
|
1
1
|
import * as winston from 'winston';
|
|
2
|
-
import { config, format, transports } from 'winston';
|
|
3
2
|
export { winston };
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const logErrors = format((info)=>{
|
|
10
|
-
if (info instanceof Error) {
|
|
11
|
-
return {
|
|
12
|
-
...info,
|
|
13
|
-
message: `${info.message}${info.stack ? `\n${info.stack}` : ''}`
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
return info;
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const defaultTimestampFormat = 'YYYY-MM-DD HH:mm:ss.SSS';
|
|
20
|
-
/**
|
|
21
|
-
* Create a pretty print formatter for a winston logger
|
|
22
|
-
* @param options
|
|
23
|
-
*/ var prettyPrint = ((options = {})=>{
|
|
24
|
-
const { timestamps = true, colors = true } = options;
|
|
25
|
-
const handlers = [];
|
|
26
|
-
if (timestamps) {
|
|
27
|
-
handlers.push(format.timestamp({
|
|
28
|
-
format: timestamps === true ? defaultTimestampFormat : timestamps
|
|
29
|
-
}));
|
|
30
|
-
}
|
|
31
|
-
if (colors) {
|
|
32
|
-
handlers.push(format.colorize());
|
|
33
|
-
}
|
|
34
|
-
handlers.push(logErrors());
|
|
35
|
-
handlers.push(format.printf(({ level, message, timestamp })=>{
|
|
36
|
-
return `${timestamps ? `[${timestamp}] ` : ''}${level}: ${message}`;
|
|
37
|
-
}));
|
|
38
|
-
return format.combine(...handlers);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
var levelFilter = ((...levels)=>{
|
|
42
|
-
return format((info)=>levels.some((level)=>info.level.includes(level)) ? info : false)();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* This will remove the chalk color codes from the message provided.
|
|
47
|
-
* It's used to log plain text in the log file
|
|
48
|
-
*/ var excludeColors = format.printf(({ message })=>{
|
|
49
|
-
if (typeof message !== 'string') {
|
|
50
|
-
return message;
|
|
51
|
-
}
|
|
52
|
-
return message.replace(// eslint-disable-next-line no-control-regex
|
|
53
|
-
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* This will remove the chalk color codes from the message provided.
|
|
58
|
-
* It's used to log plain text in the log file
|
|
59
|
-
*/ var detailedLog = format.printf(({ message, level, timestamp })=>{
|
|
60
|
-
if (typeof message !== 'string') {
|
|
61
|
-
return message;
|
|
62
|
-
}
|
|
63
|
-
const newMessage = `[${timestamp}] ${level}: ${message}`;
|
|
64
|
-
return newMessage.replace(// eslint-disable-next-line no-control-regex
|
|
65
|
-
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g, '');
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
var index$1 = /*#__PURE__*/Object.freeze({
|
|
69
|
-
__proto__: null,
|
|
70
|
-
detailedLogs: detailedLog,
|
|
71
|
-
excludeColors: excludeColors,
|
|
72
|
-
levelFilter: levelFilter,
|
|
73
|
-
prettyPrint: prettyPrint
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
var defaultConfiguration = (()=>{
|
|
77
|
-
return {
|
|
78
|
-
level: LEVEL_LABEL,
|
|
79
|
-
levels: LEVELS,
|
|
80
|
-
format: prettyPrint(),
|
|
81
|
-
transports: [
|
|
82
|
-
new transports.Console()
|
|
83
|
-
]
|
|
84
|
-
};
|
|
85
|
-
});
|
|
86
|
-
|
|
87
|
-
var outputFileConfiguration = ((filename, fileTransportOptions = {})=>{
|
|
88
|
-
return {
|
|
89
|
-
level: LEVEL_LABEL,
|
|
90
|
-
levels: LEVELS,
|
|
91
|
-
format: prettyPrint(),
|
|
92
|
-
transports: [
|
|
93
|
-
new transports.Console(),
|
|
94
|
-
new transports.File({
|
|
95
|
-
level: 'error',
|
|
96
|
-
filename,
|
|
97
|
-
format: excludeColors,
|
|
98
|
-
...fileTransportOptions
|
|
99
|
-
})
|
|
100
|
-
]
|
|
101
|
-
};
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
105
|
-
__proto__: null,
|
|
106
|
-
createDefaultConfiguration: defaultConfiguration,
|
|
107
|
-
createOutputFileConfiguration: outputFileConfiguration
|
|
108
|
-
});
|
|
3
|
+
import * as index from './configs/index.mjs';
|
|
4
|
+
export { index as configs };
|
|
5
|
+
import * as index$1 from './formats/index.mjs';
|
|
6
|
+
export { index$1 as formats };
|
|
7
|
+
import defaultConfiguration from './configs/default-configuration.mjs';
|
|
109
8
|
|
|
110
9
|
const createLogger = (userConfiguration = {})=>{
|
|
111
10
|
const configuration = defaultConfiguration();
|
|
@@ -113,5 +12,5 @@ const createLogger = (userConfiguration = {})=>{
|
|
|
113
12
|
return winston.createLogger(configuration);
|
|
114
13
|
};
|
|
115
14
|
|
|
116
|
-
export {
|
|
15
|
+
export { createLogger };
|
|
117
16
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../src/
|
|
1
|
+
{"version":3,"file":"index.mjs","sources":["../src/index.ts"],"sourcesContent":["import * as winston from 'winston';\nimport * as configs from './configs';\n\nexport * as formats from './formats';\n\nexport type Logger = winston.Logger;\n\nconst createLogger = (userConfiguration: winston.LoggerOptions = {}): winston.Logger => {\n const configuration = configs.createDefaultConfiguration();\n\n Object.assign(configuration, userConfiguration);\n\n return winston.createLogger(configuration);\n};\n\nexport { createLogger, winston, configs };\n"],"names":["createLogger","userConfiguration","configuration","configs","Object","assign","winston"],"mappings":";;;;;;;;AAOA,MAAMA,YAAe,GAAA,CAACC,iBAA2C,GAAA,EAAE,GAAA;IACjE,MAAMC,aAAAA,GAAgBC,oBAAkC,EAAA;IAExDC,MAAOC,CAAAA,MAAM,CAACH,aAAeD,EAAAA,iBAAAA,CAAAA;IAE7B,OAAOK,OAAAA,CAAQN,YAAY,CAACE,aAAAA,CAAAA;AAC9B;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@strapi/logger",
|
|
3
|
-
"version": "5.12.
|
|
3
|
+
"version": "5.12.2",
|
|
4
4
|
"description": "Strapi's logger",
|
|
5
5
|
"homepage": "https://strapi.io",
|
|
6
6
|
"bugs": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"winston": "3.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"eslint-config-custom": "5.12.
|
|
48
|
-
"tsconfig": "5.12.
|
|
47
|
+
"eslint-config-custom": "5.12.2",
|
|
48
|
+
"tsconfig": "5.12.2"
|
|
49
49
|
},
|
|
50
50
|
"engines": {
|
|
51
51
|
"node": ">=18.0.0 <=22.x.x",
|