8000 feat: add env vars for debug logger (#1204) · forcedotcom/sfdx-core@9788ca4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 9788ca4

Browse files
authored
feat: add env vars for debug logger (#1204)< 8000 /div>
1 parent d6b1916 commit 9788ca4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/logger/logger.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -452,11 +452,15 @@ export class Logger {
452452

453453
/** return various streams that the logger could send data to, depending on the options and env */
454454
const getWriteStream = (level = 'warn'): pino.TransportSingleOptions => {
455+
const env = new Env();
455456
// used when debug mode, writes to stdout (colorized)
456457
if (process.env.DEBUG) {
457458
return {
458459
target: 'pino-pretty',
459-
options: { colorize: true },
460+
options: {
461+
colorize: env.getBoolean('SF_LOG_COLORIZE') ?? true,
462+
destination: env.getBoolean('SF_LOG_STDERR') ? 2 : 1,
463+
},
460464
};
461465
}
462466

@@ -466,7 +470,7 @@ const getWriteStream = (level = 'warn'): pino.TransportSingleOptions => {
466470
['1h', new Date().toISOString().split(':').slice(0, 1).join('-')],
467471
['1d', new Date().toISOString().split('T')[0]],
468472
]);
469-
const logRotationPeriod = new Env().getString('SF_LOG_ROTATION_PERIOD') ?? '1d';
473+
const logRotationPeriod = env.getString('SF_LOG_ROTATION_PERIOD') ?? '1d';
470474

471475
return {
472476
// write to a rotating file

0 commit comments

Comments
 (0)
0