How to use the record function from npmlog

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

190
191
192
193
194
195
196
197
198
199

The level to display logs at.  Any logs at or above this level will be
displayed.  The special level `silent` will prevent anything from being
displayed ever.

## log.record

* {Array}

An array of all the log messages that have been entered.
fork icon19
star icon22
watch icon13

+ 9 other calls in file

83
84
85
86
87
88
89
90
91
92

function reallyExit (er) {
  if (er && !code) code = typeof er.errno === 'number' ? er.errno : 1

  // truncate once it's been written.
  log.record.length = 0

  itWorked = !code

  // just emit a fake exit event.
fork icon11
star icon113
watch icon6

+ 3 other calls in file

229
230
231
232
233
234
235
236
237

var os = require('os')

try {
  var logOutput = ''
  log.record.forEach(function (m) {
    var pref = [m.id, m.level]
    if (m.prefix) pref.push(m.prefix)
    pref = pref.join(' ')
fork icon0
star icon0
watch icon0

4
5
6
7
8
9
10
11
12
13
14
15
16


module.exports.loggingOutput = loggingOutput;


// clear logs between tests
afterEach(() => {
  log.record.length = 0;
});


function loggingOutput(minLevel = "info") {
  // returns an array of log messages at or above the prescribed minLevel
fork icon0
star icon0
watch icon0