How to use the on function from npmlog

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

197
198
199
200
201
202
203
204
205
206

// Open the specified file.
fd = fs.openSync(stream, 'a', '0644');

// Set up a listener for log events.
npmlog.on('log', function(m) {
  if (fd) {
    if (npmlog.levels[npmlog.level] <= npmlog.levels[m.level]) {
      // We'll get called for every log event, so filter to ones we're
      // interested in.
fork icon9
star icon18
watch icon3

21
22
23
24
25
26
27
28
29
30
var init = requireInject('../../lib/init', {
  'init-package-json': initJsonMock
})

// capture log messages
npmlog.on('log', function (chunk) { log += chunk.message + '\n' })

init([], function (err, code) {
  t.ifError(err, 'init ran successfully')
  t.notOk(code, 'exited without issue')
fork icon0
star icon0
watch icon0

13
14
15
16
17
18
19
20
21
22
23
24


test("issue #6735 build 'already built' message", function (t) {
  npm.load({ loglevel: 'warn' }, function () {
    // capture log messages with level
    var log = ''
    npmlog.on('log', function (chunk) {
      log += chunk.level + ' ' + chunk.message + '\n'
    })


    mkdirp.sync(fakePkg)
fork icon0
star icon0
watch icon0