How to use the levels function from npmlog

Find comprehensive JavaScript npmlog.levels code examples handpicked from public code repositorys.

23
24
25
26
27
28
29
30
31
32
  log.error('', 'cb() never called!')
}

if (wroteLogFile) {
  // just a line break
  if (log.levels[log.level] <= log.levels.error) console.error('')

  log.error(
    '',
    [
fork icon11
star icon113
watch icon6

+ 7 other calls in file

28
29
30
31
32
33
34
35
36
37
```

__levels:__

```js
> log.levels
{ silly: -Infinity,
  verbose: 1000,
  info: 2000,
  http: 3000,
fork icon7
star icon40
watch icon4

+ 3 other calls in file

125
126
127
128
129
130
131
132
133
134
npmlog.level = lvl;

header('header', logger.NO_CLIENT_ID, {title: 'Log'});

var debug = process.env.PN_TRACE_FRM + ',' || '';
if (npmlog.levels[npmlog.level] <= npmlog.levels.debug) {
  logger.log('debug', logger.NO_CLIENT_ID, 'Setting basic amqp10 debug');
  process.env.DEBUG =
      debug + 'amqp10:*,-amqp10:session,-amqp10:framing,-amqp10:sasl';
  if (npmlog.levels[npmlog.level] <= npmlog.levels.detail) {
fork icon9
star icon18
watch icon3

+ 3 other calls in file

69
70
71
72
73
74
75
76
77
    process.stdout.write = wrapWrite(process.stdout.write);
    process.stderr.write = wrapWrite(process.stderr.write);
}

// Add custom log levels
log.addLevel('stat', log.levels.warn - 100, { fg: 'green', bg: 'black' });

// Print whole objects and not 2 levels deep
log.log = wrap(log.log, npmLog);
fork icon48
star icon0
watch icon2

+ 3 other calls in file

16
17
18
19
20
21
22
23
24
25
26
27
const auditError = require('./audit-error.js')


// TODO: output JSON if flatOptions.json is true
const reifyOutput = (npm, arb) => {
  // don't print any info in --silent mode
  if (log.levels[log.level] > log.levels.error)
    return


  const { diff, actualTree } = arb

fork icon0
star icon0
watch icon0