1 | const LOG_LEVELS = ['silent', 'error', 'warn', 'notice', 'http', 'info', 'verbose', 'silly'];
|
2 | export function determineLogLevel(config, flags, defaultLevel) {
|
3 | if (flags.verbose)
|
4 | return 'verbose';
|
5 | if (flags.silent)
|
6 | return 'silent';
|
7 | const envVar = config.scopedEnvVar('NPM_LOG_LEVEL');
|
8 | if (LOG_LEVELS.includes(envVar))
|
9 | return envVar;
|
10 | return defaultLevel;
|
11 | }
|