Skip to content

Commit dcbad04

Browse files
committed
logging nits
1 parent f2114f3 commit dcbad04

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

AGENTS.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,9 @@
1616
- TypeDoc and vitepress will generate documentation from these comments in the `./docs/api` folder
1717
- module level jsdocs will be used for organization; for example packages/b2c-tooling/src/auth/index.ts barrel file has the module level docs for the `auth` module
1818
- see the typedoc.json file for configuration options including the entry points for documentation generation
19+
20+
## Logging
21+
22+
- when logging use the logger instance from `@salesforce/b2c-tooling/logger` package
23+
- CLI commands have access to this logger via `this.log` method from oclif Command class
24+
- CLI

cli

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env sh
2+
# simple wrapper to the ./packages/b2c-cli/bin/dev.js script
3+
pushd ./packages/b2c-cli > /dev/null
4+
./bin/dev.js "$@"
5+
popd > /dev/null

packages/b2c-tooling/src/cli/base-command.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,10 @@ export abstract class BaseCommand<T extends typeof Command> extends Command {
8787
* Priority: NO_COLOR > SFCC_LOG_COLORIZE > TTY detection
8888
*/
8989
private shouldColorize(): boolean {
90-
// NO_COLOR is the industry standard
9190
if (process.env.NO_COLOR !== undefined) {
9291
return false;
9392
}
9493

95-
// Explicit override
96-
const colorizeEnv = process.env.SFCC_LOG_COLORIZE;
97-
if (colorizeEnv !== undefined) {
98-
return colorizeEnv !== 'false' && colorizeEnv !== '0';
99-
}
100-
10194
// Default: colorize if stderr is a TTY
10295
return process.stderr.isTTY ?? false;
10396
}

packages/b2c-tooling/src/logging/logger.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function createPinoLogger(options: LoggerOptions): Logger {
6464
destination: fd,
6565
sync: true,
6666
colorize,
67-
ignore: 'pid,hostname',
67+
ignore: 'pid,hostname' + (isVerbose ? '' : ',time'),
6868
hideObject: !isVerbose,
6969
});
7070

0 commit comments

Comments
 (0)