@salesforce/core 8.13.0 → 8.14.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/lib/logger/logger.js +6 -2
- package/package.json +1 -1
package/lib/logger/logger.js
CHANGED
|
@@ -391,11 +391,15 @@ class Logger {
|
|
|
391
391
|
exports.Logger = Logger;
|
|
392
392
|
/** return various streams that the logger could send data to, depending on the options and env */
|
|
393
393
|
const getWriteStream = (level = 'warn') => {
|
|
394
|
+
const env = new kit_1.Env();
|
|
394
395
|
// used when debug mode, writes to stdout (colorized)
|
|
395
396
|
if (process.env.DEBUG) {
|
|
396
397
|
return {
|
|
397
398
|
target: 'pino-pretty',
|
|
398
|
-
options: {
|
|
399
|
+
options: {
|
|
400
|
+
colorize: env.getBoolean('SF_LOG_COLORIZE') ?? true,
|
|
401
|
+
destination: env.getBoolean('SF_LOG_STDERR') ? 2 : 1,
|
|
402
|
+
},
|
|
399
403
|
};
|
|
400
404
|
}
|
|
401
405
|
// default: we're writing to a rotating file
|
|
@@ -404,7 +408,7 @@ const getWriteStream = (level = 'warn') => {
|
|
|
404
408
|
['1h', new Date().toISOString().split(':').slice(0, 1).join('-')],
|
|
405
409
|
['1d', new Date().toISOString().split('T')[0]],
|
|
406
410
|
]);
|
|
407
|
-
const logRotationPeriod =
|
|
411
|
+
const logRotationPeriod = env.getString('SF_LOG_ROTATION_PERIOD') ?? '1d';
|
|
408
412
|
return {
|
|
409
413
|
// write to a rotating file
|
|
410
414
|
target: 'pino/file',
|