How to use the log function from npmlog

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

247
248
249
250
251
252
253
254
255
256

## log.resume()

Emit all buffered messages that were written while paused.

## log.log(level, prefix, message, ...)

* `level` {String} The level to emit the message at
* `prefix` {String} A string prefix.  Set to "" to skip.
* `message...` Arguments to `util.format`
fork icon19
star icon22
watch icon13

+ 9 other calls in file

127
128
129
130
131
132
133
134
135
136
}

this.setErrorPopupMessage(title);

if (err) {
  log.log('warn', titleText);
} else {
  log.log('warn', titleText, {
    name: err.name,
    message: err.message
fork icon414
star icon0
watch icon17

+ 3 other calls in file

39
40
41
42
43
44
45
46
47
48
          ctx.options.log.report &&
          typeof ctx.options.log.report === 'function'
        ) {
          ctx.options.log.report(content, type);
        }
        log.log(type, '', content);
      };
    });
  }
};
fork icon192
star icon0
watch icon53

73
74
75
76
77
78
79
80
81
82
npmlog.log(lvl, clientId, '| Date/Time         :-',
           moment().format('ddd MMMM DD YYYY HH:mm:ss.SSS Z'));
npmlog.log(lvl, clientId, '| Host Name         :-', os.hostname());
npmlog.log(lvl, clientId, '| Operating System  :-',
           os.type(), os.release());
npmlog.log(lvl, clientId, '| Architecture      :-',
           os.platform(), os.arch());
npmlog.log(lvl, clientId, '| Node Version      :-', process.version);
npmlog.log(lvl, clientId, '| Node Path         :-', process.execPath);
npmlog.log(lvl, clientId, '| Node Arguments    :-', process.execArgs);
fork icon9
star icon18
watch icon3

+ 51 other calls in file

0
1
2
3
4
5
6
7
8
9
10
11
12
13


const NPMLOG = require('npmlog')
const { LEVELS } = require('proc-log')


const npmEmitLog = NPMLOG.emitLog.bind(NPMLOG)
const npmLog = NPMLOG.log.bind(NPMLOG)


const merge = (...objs) => objs.reduce((acc, obj) => ({ ...acc, ...obj }))


const mockLogs = (otherMocks = {}) => {
fork icon0
star icon0
watch icon0

+ 3 other calls in file

31
32
33
34
35
36
37
38
39
40
      args.forEach(
        (arg, i) =>
          typeof arg === 'object' && arg instanceof Error && arg.stack && arg.message && (args[i] = arg.message)
      );
    }
    log.log.apply(log, [v].concat(args));
  };
});

mylog.level = v => (v ? (log.level = v) : log.level);
fork icon0
star icon0
watch icon727

+ 11 other calls in file