Skip to content

Commit

Permalink
use numeric loglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
milahu committed Apr 1, 2022
1 parent c3ace4c commit 13b5f00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions packages/default-reporter/src/reporterForClient/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import reportDeprecations from './reportDeprecations'
import reportHooks from './reportHooks'
import reportInstallChecks from './reportInstallChecks'
import reportLifecycleScripts from './reportLifecycleScripts'
import reportMisc from './reportMisc'
import reportMisc, { LOG_LEVEL_NUMBER } from './reportMisc'
import reportPeerDependencyIssues from './reportPeerDependencyIssues'
import reportProgress from './reportProgress'
import reportRequestRetry from './reportRequestRetry'
Expand Down Expand Up @@ -100,9 +100,13 @@ export default function (
reportUpdateCheck(log$.updateCheck),
]

if (opts.logLevel !== 'error') {
// logLevelNumber: 0123 = error warn info debug
const logLevelNumber = LOG_LEVEL_NUMBER[opts.logLevel ?? 'info'] ?? LOG_LEVEL_NUMBER['info']

if (logLevelNumber >= LOG_LEVEL_NUMBER.warn) {
outputs.push(reportDeprecations(log$.deprecation, { cwd, isRecursive: opts.isRecursive }))
}

if (!opts.appendOnly) {
outputs.push(reportBigTarballsProgress(log$))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import formatWarn from './utils/formatWarn'
import { autozoom } from './utils/zooming'

// eslint-disable:object-literal-sort-keys
const LOG_LEVEL_NUMBER: Record<LogLevel, number> = {
export const LOG_LEVEL_NUMBER: Record<LogLevel, number> = {
error: 0,
warn: 1,
info: 2,
Expand Down

0 comments on commit 13b5f00

Please sign in to comment.