How to use the info function from npmlog
Find comprehensive JavaScript npmlog.info code examples handpicked from public code repositorys.
npmlog.info is a function in the npmlog library that logs an informational message to the console with the prefix "info:".
15 16 17 18 19 20 21 22 23 24
process.on('exit', function (code) { log.disableProgress() if (!npm.config || !npm.config.loaded) return if (code) itWorked = false if (itWorked) log.info('ok') else { if (!cbCalled) { log.error('', 'cb() never called!') }
+ 3 other calls in file
62 63 64 65 66 67 68 69 70 71
.concat(libsFoundInDir.map(lib => '-lopencv_' + lib.opencvModule)) .concat('-Wl,-rpath,' + libDir) console.log() log.info('install', 'setting the following defines:') defines.forEach(def => log.info('defines', def)) console.log() log.info('install', 'setting the following includes:') includes.forEach(inc => log.info('includes', inc)) console.log()
+ 77 other calls in file
How does npmlog.info work?
npmlog.info is a function in the npmlog library that logs an informational message to the console with the prefix "info:". It takes two arguments: the first is a string that represents the name of the module that is logging the message, and the second is a message string to be logged. The npmlog library is commonly used in Node.js projects to log messages to the console or to a file. It provides several logging levels, including silly, verbose, info, warn, and error, each of which can be used to convey different types of messages. When npmlog.info is called, it checks the current logging level set in the npmlog instance to determine whether the message should actually be logged. If the logging level is set to silly, verbose, info, or warn, the message will be logged to the console along with the prefix "info:". If the logging level is set to error, the message will not be logged, since npmlog.info is not an error-level log method. By default, npmlog uses the global console object to log messages, but it can be configured to use a custom logger function or to write messages to a file instead.
GitHub: jaredpalmer/mailtrain
![jaredpalmer profile picture](/jaredpalmer.png?size=40)
96 97 98 99 100 101 102 103 104 105
app.use(logger(config.www.log, { stream: { write: message => { message = (message || '').toString(); if (message) { log.info('HTTP', message.replace('\n', '').trim()); } } } }));
+ 3 other calls in file
GitHub: Mailtrain-org/mailtrain
![Mailtrain-org profile picture](/Mailtrain-org.png?size=40)
32 33 34 35 36 37 38 39
createDump(err => { if (err) { log.error('sqldump', err); process.exit(1); } log.info('sqldump', 'MySQL Dump Completed'); process.exit(0); });
+ 13 other calls in file
Ai Example
1 2 3
const npmlog = require("npmlog"); npmlog.info("myapp", "Hello, world!");
In this example, we import the npmlog library and then call npmlog.info with the string "myapp" as the module name and "Hello, world!" as the message. When this code is executed, npmlog will log the message "info: myapp Hello, world!" to the console.
GitHub: DexterInd/GrovePi
![DexterInd profile picture](/DexterInd.png?size=40)
163 164 165 166 167 168 169 170 171 172
this.debug('Unknown pin mode') } } GrovePi.prototype.debug = function(msg) { if (this.debugMode) log.info('GrovePi.board', msg) } GrovePi.prototype.wait = function(ms) { sleep.usleep(1000 * ms) }
+ 3 other calls in file
GitHub: AdStage/testem
![AdStage profile picture](/AdStage.png?size=40)
15 16 17 18 19 20 21 22 23
} TapConsumer.prototype = { __proto__: EventEmitter.prototype, onTapAssert: function(data) { log.info(data); if (data.skip) { return; }
GitHub: AdStage/testem
![AdStage profile picture](/AdStage.png?size=40)
94 95 96 97 98 99 100 101 102 103
this.viewRunners.push(viewRunner); var idx = this.viewRunners.length - 1; this.x[runner.launcherId] = viewRunner; log.info('runnerAdded', runner.name(), runner.launcherId); var tab = new RunnerTab({ runner: viewRunner, index: idx,
+ 7 other calls in file
GitHub: stutrek/testem
![stutrek profile picture](/stutrek.png?size=40)
95 96 97 98 99 100 101 102 103 104
this.runnerTabs.push(tab); this.set('atLeastOneRunner', this.viewRunners.length > 0); }, runnerRemoved(runner) { log.info('runnerRemoved'); this.viewRunners.remove(this.x[runner.launcherId]); this.set('atLeastOneRunner', this.viewRunners.length > 0); },
+ 7 other calls in file
GitHub: suderman/smsglue
![suderman profile picture](/suderman.png?size=40)
132 133 134 135 136 137 138 139 140 141
// No devices to notify, hit the callback now if (!devices.length) cb(); // This will be called after each request, but only do anything after the final request var updateCachedDevices = function() { // log.info('updateCachedDevices', `sent count: ${sent}`); // If number of messages sent matches the number of devices... if (sent >= devices.length) { // log.info('updateCachedDevices', 'sent matches device length');
+ 5 other calls in file
11 12 13 14 15 16 17 18 19 20
function mutateModule(repo, callback){ assert(repo instanceof Repo) assert(typeof callback === 'function') log.info(repo, 'mutating module') fs.readFile(path.join(repo.dirpath(), 'component.json'), function(err, data){ if (err) { if (err.code === 'ENOENT'){ log.error(repo, 'component.json not found.')
+ 11 other calls in file
GitHub: siuying/jxcore
![siuying profile picture](/siuying.png?size=40)
64 65 66 67 68 69 70 71 72 73
addNameTag(name, version, data, cb) } } function addNameTag (name, tag, data, cb) { log.info('addNameTag', [name, tag]) var explicit = true if (!tag) { explicit = false tag = npm.config.get('tag')
+ 11 other calls in file
GitHub: siuying/jxcore
![siuying profile picture](/siuying.png?size=40)
145 146 147 148 149 150 151 152 153 154
}) } // don't try too hard to hold on to a remote function resetRemote (from, cloneURL, treeish, cachedRemote, cb) { log.info('resetRemote', 'resetting', cachedRemote, 'for', from) rm(cachedRemote, function (er) { if (er) return cb(er) mirrorRemote(from, cloneURL, treeish, cachedRemote, false, cb) })
49 50 51 52 53 54 55 56 57 58
Bucket: config.bucket }; log.info('publish', 'Putting object', s3_put_opts.ACL, s3_put_opts.Bucket, s3_put_opts.Key); try { s3.putObject(s3_put_opts, (err2, resp) => { log.info('publish', 'returned from putting object'); if (err2) { log.info('publish', 's3 putObject error: "' + err2 + '"'); return callback(err2); }
+ 129 other calls in file
GitHub: nodemailer/wildduck
![nodemailer profile picture](/nodemailer.png?size=40)
107 108 109 110 111 112 113 114 115 116
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'); }); }); }); });
+ 35 other calls in file
GitHub: wvbe/node-schematron
![wvbe profile picture](/wvbe.png?size=40)
40 41 42 43 44 45 46 47 48
}; npmlog.level = req.options['log-level']; if (req.parameters.glob) { npmlog.info('init', `Locating files matching "${req.parameters.glob}"`); } npmlog.info('init', `Reading schema from "${req.parameters.schematron}"`);
+ 9 other calls in file
23 24 25 26 27 28 29 30 31
const members = list.members.map(member => ( _.pick(member, ['id', 'status', 'email_address', 'merge_fields']) )) log.info(logGroup, `Found ${members.length} mailchimp audience members.`) options.debug && console.log(JSON.stringify(members, null, 2))
+ 15 other calls in file
GitHub: semantic-release/cli
![semantic-release profile picture](/semantic-release.png?size=40)
59 60 61 62 63 64 65 66 67 68
const {result} = await pify(travis.hooks(travis.repoid).put.bind(travis))({ hook: {active: true}, }); if (!result) throw new Error('Could not enable hook on Travis CI'); log.info('Successfully created Travis CI hook.'); await setEnvVar(travis, 'GH_TOKEN', info.github.token); if (info.npm.authmethod === 'token') {
+ 15 other calls in file
30 31 32 33 34 35 36 37 38 39
} // Generate each letter icon "synchronously" async.eachSeries(letters, function(letter, cbAsync) { // Log current letter log.info('material-letter-icons', 'Generating icon: ' + letter); // Generate an icon for the current letter generateLetterIcon(letter, function(err) { // Handle errors
GitHub: styfle/vdx
![styfle profile picture](/styfle.png?size=40)
7 8 9 10 11 12 13 14 15 16
npmlog.error('', message) } npmlog.style.info.fg = 'yellow' function info (message) { npmlog.info('', message) } npmlog.addLevel('start', 2001, { fg: 'blue' }) function start (message) {
+ 3 other calls in file
GitHub: nodemailer/wildduck
![nodemailer profile picture](/nodemailer.png?size=40)
110 111 112 113 114 115 116 117 118
server.listen(config.acme.agent.port, config.acme.agent.host, () => { if (started) { return server.close(); } started = true; log.info('ACME', 'Server listening on %s:%s', config.acme.agent.host || '0.0.0.0', config.acme.agent.port); done(null, server); }); };
+ 7 other calls in file
npmlog.verbose is the most popular function in npmlog (7425 examples)