How to use the verbose function from npmlog

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

npmlog.verbose is a method provided by the npmlog package that is used to log verbose-level messages during a Node.js process.

58
59
60
61
62
63
64
65
66
67
if (req.body.Message.complaint) {
    campaigns.updateMessage(message, 'complained', true, (err, updated) => {
        if (err) {
            log.error('AWS', 'Failed updating message: %s', err.stack);
        } else if (updated) {
            log.verbose('AWS', 'Marked message %s as complaint', req.body.Message.mail.messageId);
        }
    });
}
break;
fork icon702
star icon4
watch icon3

+ 15 other calls in file

23
24
25
26
27
28
29
30
31
32
let tmp = config.www.tmpdir || os.tmpdir();
let dir = pathlib.join(tmp, 'mailtrain');
mkdirp(dir, err => {
    if (err) {
        log.error('Upload', err);
        log.verbose('Upload', 'Storing upload to <%s>', tmp);
        return callback(null, tmp);
    }
    log.verbose('Upload', 'Storing upload to <%s>', dir);
    callback(null, dir);
fork icon702
star icon1
watch icon3

+ 5 other calls in file

How does npmlog.verbose work?

npmlog.verbose() is a function provided by the npmlog package that logs messages with a verbosity level of "verbose". When the verbosity level is set to "verbose" using the npmlog.level property or the --verbose command line option, the messages logged with npmlog.verbose() will be displayed along with messages logged at the default log level. If the verbosity level is set to a lower level than "verbose", the messages logged with npmlog.verbose() will be ignored. The npmlog.verbose() function takes a message string and an optional set of arguments, and logs the message with the prefix "[verbose]". The message string can contain placeholders that will be replaced with the argument values, using the same syntax as console.log().

32
33
34
35
36
37
38
39
40
41
mapToRegistry(name, npm.config, function (er, uri, auth) {
  if (er) return done(er)

  var key = 'registry:' + uri
  next = inflight(key, next)
  if (!next) return log.verbose(from, key, 'already in flight; waiting')
  else log.verbose(from, key, 'not in flight; fetching')

  npm.registry.get(uri, { auth: auth }, pulseTillDone('fetchRegistry', fixName))
})
fork icon322
star icon0
watch icon2

+ 59 other calls in file

36
37
38
39
40
41
42
43
44
45
function addRemoteGit (uri, _cb) {
  assert(typeof uri === 'string', 'must have git URL')
  assert(typeof _cb === 'function', 'must have callback')
  var cb = dezalgo(_cb)

  log.verbose('addRemoteGit', 'caching', uri)

  // the URL comes in exactly as it was passed on the command line, or as
  // normalized by normalize-package-data / read-package-json / read-installed,
  // so figure out what to do with it using hosted-git-info
fork icon322
star icon0
watch icon2

+ 15 other calls in file

Ai Example

1
2
3
4
5
6
7
8
9
10
const npmlog = require("npmlog");
npmlog.level = "verbose";

function foo() {
  // Do something
  npmlog.verbose("Additional Info", "This is some additional information");
  // Do something else
}

foo();

In this example, the npmlog.verbose() call logs the message "This is some additional information" with the prefix "Additional Info" at the verbose log level. This message will only be logged if the npmlog level is set to verbose.

105
106
107
108
109
110
111
112
113
114
    }
}

plugins.init('receiver');
plugins.handler.load(() => {
    log.verbose('Plugins', 'Plugins loaded');
    plugins.handler.runHooks('init', [], () => {
        log.info('App', 'All servers started, ready to process some mail');
    });
});
fork icon245
star icon0
watch icon54

+ 11 other calls in file

111
112
113
114
115
116
117
118
119
120

if (!hasFeatureFlag) {
    log.silly('Indexer', `Feature flag not set, skipping user=%s command=%s message=%s`, entry.user, entry.command, entry.message);
    return;
} else {
    log.verbose('Indexer', `Feature flag set, processing user=%s command=%s message=%s`, entry.user, entry.command, entry.message);
}

await liveIndexingQueue.add('journal', payload, {
    removeOnComplete: 100,
fork icon245
star icon0
watch icon54

260
261
262
263
264
265
266
267
268
269
## log\[level](prefix, message, ...)

For example,

* log.silly(prefix, message, ...)
* log.verbose(prefix, message, ...)
* log.info(prefix, message, ...)
* log.http(prefix, message, ...)
* log.warn(prefix, message, ...)
* log.error(prefix, message, ...)
fork icon19
star icon22
watch icon13

+ 9 other calls in file

1
2
3
4
5
6
7
8
9
10

var $ = require('preconditions').singleton();
var _ = require('lodash');
var async = require('async');
var log = require('npmlog');
log.debug = log.verbose;

var BlockchainExplorer = require('./blockchainexplorer');
var Storage = require('./storage');
var MessageBroker = require('./messagebroker');
fork icon0
star icon1
watch icon4

65
66
67
68
69
70
71
72
73
74
            }
      
          });
        }
            
        logger.verbose('user ' + decodedJWT.jwt + ' authenticated successfully');
        
        cb(null, decodedJWT);
    }
));
fork icon1
star icon2
watch icon10

129
130
131
132
133
134
135
136
137
138
if (error) {
  var stack = new Error().stack.split('\n').slice(2).join('\n')
  return log.error('app', 'Failed to initialise:\n' + stack, error)
}

log.verbose('app', 'Starting')

server.start(function () {
  console.log((useEmoji ? emoji.get('dog') + '  ' : '') + 'Your Hoodie app has started on ' + url.format({
    protocol: 'http',
fork icon459
star icon0
watch icon1

+ 7 other calls in file

55
56
57
58
59
60
61
62
63
64

function exit (code, noLog) {
  exitCode = exitCode || process.exitCode || code

  var doExit = npm.config ? npm.config.get('_exit') : true
  log.verbose('exit', [code, doExit])
  if (log.level === 'silent') noLog = true

  if (rollbacks.length) {
    chain(rollbacks.map(function (f) {
fork icon11
star icon113
watch icon6

+ 11 other calls in file

81
82
83
84
85
86
87
88
89
90
module.exports = getPublishConfig
&nbsp;
function getPublishConfig (publishConfig, defaultConfig, defaultClient) {
  var config = defaultConfig
  var client = defaultClient
  log.verbose('getPublishConfig', publishConfig)
  if (publishConfig) {
    config = new Conf(defaultConfig)
    config.save = defaultConfig.save.bind(defaultConfig)
&nbsp;
fork icon0
star icon2
watch icon3

57
58
59
60
61
62
63
64
65
66
});

let npmlogItem = null;
let timeStartAnalysis = null;
events.on('start', () => {
        npmlog.verbose('init', '%s files located in %s milliseconds', stats.files, Date.now() - timeStartGlob);
        npmlog.enableProgress();
        npmlog.info('init', `Starting validation`);

        npmlogItem = npmlog.newItem('0 of ' + stats.files, stats.files);
fork icon2
star icon9
watch icon4

+ 11 other calls in file

39
40
41
42
43
44
45
46
47
48
        mapParams: true
    })
);

this.server.pre((request, response, next) => {
    log.verbose('HTTP', request.url);
    next();
});

this.setupRoutes();
fork icon83
star icon526
watch icon44

39
40
41
42
43
44
45
46
47
48
  log.info('unpack', 'no archives to process! CU L8R SAILOR')
  log.disableProgress()
  process.exit(0)
}

log.verbose('unpack', 'processing', files)
files.forEach(f => groups.set(f, log.newGroup('process: ' + f)))
return Promise.map(
  files,
  f => extractRelease(f, tmpdir, covers, groups),
fork icon1
star icon0
watch icon3

+ 9 other calls in file

13
14
15
16
17
18
19
20
21
22
  log.info(`[${fileName}] :`, textToLog);
},
verbose: (fileName, textToLog) => {
  log.stream = process.stdout;
  log.prefixStyle = { fg: 'blue' };
  log.verbose(`[${fileName}] :`, textToLog);
},
error: (fileName, textToError) => {
  log.stream = process.stderr;
  log.prefixStyle = { fg: 'red' };
fork icon1
star icon24
watch icon18

217
218
219
220
221
222
223
224
225
226
log.silly(`Adding listener for ${channel}`);

subs[channel] = subs[channel] || [];

if (subs[channel].length === 0) {
  log.verbose(`Subscribe ${channel}`);
  redisSubscribeClient.subscribe(channel, onRedisMessage);
}

subs[channel].push(callback);
fork icon2
star icon4
watch icon2

+ 349 other calls in file

57
58
59
60
61
62
63
64
65
log.verbose('yelm', 'Started watcher')
scraper.watchFor(config.watchFor) // Watch for new builds.

scraper.on('build', async(build) => {
  if (build.env === config.patchFor) { // only patch if it's the release channel is that specified in the config
    log.verbose('yelm', 'Received build details. Beginning patch procedure.')
    patcher.patch(build) // Send build details to patch function.
  }
})
fork icon1
star icon1
watch icon0

+ 7 other calls in file

30
31
32
33
34
35
36
37
38
39
  },
  [] // don't want rc interpreting argv
)

function saveConfig (argv) {
  log.verbose('saveConfig', 'saving to', configPath)
  // JSON.parse(JSON.Stringify()) is an easy way to clear out undefined values,
  // which ini will go ahead and save as the string "undefined", which is not
  // what I want.
  const toSave = JSON.parse(JSON.stringify({
fork icon1
star icon0
watch icon3

+ 9 other calls in file

58
59
60
61
62
63
64
65
66
67
.then(utils.parseAndCheckLogin(ctx, defaultFuncs))
.then(function(resData) {
  if (resData.error) {
    throw resData;
  }
  log.verbose("getThreadList", JSON.stringify(resData.payload.threads));
  return callback(
    null,
    (resData.payload.threads || []).map(utils.formatThread)
  );
fork icon0
star icon1
watch icon1

+ 8 other calls in file