How to use the info function from loglevel
Find comprehensive JavaScript loglevel.info code examples handpicked from public code repositorys.
loglevel.info is a method in the loglevel library that logs an informational message to the console or other output, depending on the log level configuration.
59 60 61 62 63 64 65 66 67 68
/** * @returns {Promise.<void>} */ async scan() { log.info('Scanning'); await Process.spawn(scanimageCommand.scan(this.request)); } /**
+ 9 other calls in file
GitHub: cxw42/TabFern
115 116 117 118 119 120 121 122 123 124 125 126
function loadSettingsFromObject(obj) { let ok = true; let errmsgs = ''; function stash(m) { errmsgs += `<li>${m}</li>`; } log.info({'Loading settings from':obj}); for(let key in S.defaults) { if(!obj[key]) { log.info(`Setting ${key} not found - skipping`);
+ 23 other calls in file
How does loglevel.info work?
loglevel.info is a method in the loglevel library that logs an informational message to the console or other output, depending on the log level configuration. When you call loglevel.info(message), the message is passed to the loglevel instance's logging function. This function checks the log level configuration to determine whether to actually log the message. For example, if the log level is set to warn, error, or silent, then loglevel.info will not actually log the message to the console or other output. By default, loglevel logs messages to the console using console.log. However, you can configure loglevel to use a different output method, such as a file or a custom logging function. In essence, loglevel.info provides a way to log informational messages to the console or other output, while respecting the log level configuration.
GitHub: cxw42/TabFern
26 27 28 29 30 31 32 33 34 35 36 37
const Esc = require('lib/justhtmlescape'); const BLAKE2s = require('blake2s-js'); var Buffer = require('buffer/'); if(Buffer.Buffer) Buffer = Buffer.Buffer; // buffalo buffalo buffalo function loginfo(...args) { log.info('TabFern view/item.js: ', ...args); }; // }}}1 /// The module we are creating let me = {};
+ 120 other calls in file
84 85 86 87 88 89 90 91 92 93
res.end(); }, }); loginStatus = `Login called, expecting redirect function to redirect the user's browser now...`; log.info(loginStatus); } catch (error) { loginStatus = `Login attempt failed: [${error}]`; log.error(loginStatus); sendHtmlResponse(res);
+ 4 other calls in file
Ai Example
1 2 3 4 5 6 7 8 9 10 11 12 13
const log = require("loglevel"); // Set the log level to 'info' log.setLevel("info"); // Log an informational message log.info("This is an informational message."); // Set the log level to 'warn' log.setLevel("warn"); // Try to log an informational message again log.info("This message will not be logged.");
In this example, we first import the loglevel library and set the log level to info using the setLevel method. Next, we log an informational message using log.info. We then change the log level to warn, which means that only warning messages and higher will be logged. Finally, we try to log another informational message using log.info, but because the log level is now set to warn, the message will not be logged. Note that loglevel provides other log methods besides info, such as debug, warn, and error, which each correspond to different log levels.
12 13 14 15 16 17 18 19 20 21
// Connect to mongodb await connectToMongo() // Setup AppService await AppService.init(ServerService) // Ready! log.info(`Listening on *:${port} 🙉`) /** |-------------------------------------------------- | For Debugging: Reset board and settings |--------------------------------------------------
190 191 192 193 194 195 196 197 198 199
.catch(error => { return null; }); if (!regionId) { log.info('Image(s) not in a region channel, won\'t be processed'); return; } const imageUrls = message.attachments
+ 3 other calls in file
117 118 119 120 121 122 123 124 125 126
...mount_options ] ) proc.stdout.on('data', (data) => { log.info(data.toString()); }); proc.stderr.on('data', (data) => { log.error(data.toString());
+ 342 other calls in file
59 60 61 62 63 64 65 66 67 68 69
* Background sync to fetch data * * @returns {Promise} Resolves to this if connection succeeded. */ module.exports.backgroundSyncMessages = async () => { log.info(getTimestamp() + ' INFO: Background syncing.') let message_was_unknown try { const resp = await fetch('http://' + process.env.SYS_HUGIN_NODE_SERVER + '/get_pool_changes_lite', {
+ 119 other calls in file
GitHub: kryptokrona/hugin-api
47 48 49 50 51 52 53 54 55 56 57
* Open a wallet * * @returns {String} */ async function openWallet(daemon) { log.info(getTimestamp() + ' INFO: Open wallet...') const walletExists = await walletExistsInDb() if (walletExists) { log.info(getTimestamp() + ' INFO: Wallet found, loading...')
+ 155 other calls in file
150 151 152 153 154 155 156 157 158 159
curseWord = containCurseWord(messageObj.message) } // all checks if the message should go through or not if (curseWord) { log.info(getTimestamp() + ' INFO: Message contains curse words.') return false } else { if ( criteriaUsersInclude &&
+ 26 other calls in file
78 79 80 81 82 83 84 85 86 87
} if (urlParams.get('debug') !== null) { this.m32CwGeneratorUI.setDebug(true); this.echoTrainerUI.setDebug(true); log.info('debug mode enabled!'); // receiveTextQsoTrainer.addEventListener('input', function(event) { // detectQso(); // }); } else {
+ 3 other calls in file
667 668 669 670 671 672 673 674 675 676
break; default: console.log('unhandled json key', key); } } else { log.info('cannot handle json', jsonObject); } } }
+ 12 other calls in file
GitHub: medic/couch2pg
16 17 18 19 20 21 22 23 24 25
postgresqlUrl = target; }); program.on('--help', function() { log.info(' <source> should be a valid CouchDB URL'); log.info(' <target> should be a valid PostgreSQL URL'); log.info(''); log.info(' Examples:'); log.info(''); log.info(' $ couch2pg "http://admin:pass@localhost:5984/db" "postgres://user:pass@localhost:5432/db"');
+ 11 other calls in file
142 143 144 145 146 147 148 149 150 151
return Promise.all(view_creation_promises); }).then(()=>{ EXEC_START = new Date(); var req_batches = WORKLOAD["blocks"]; LOGGER.info(`# of Request Batches: ${req_batches.length}`); return req_batches.reduce( async (previousPromise, req_batch) => { await previousPromise; BATCH_ID+=1;
+ 13 other calls in file
11 12 13 14 15 16 17 18
const app = require('./app'); const port = process.env.NODE_PORT || 3006; app.listen(port, () => { log.info(`listening on port:${port}`); log.debug('debug log level!'); });
53 54 55 56 57 58 59 60 61 62 63
function debugLog(browserWindow, message) { // need the timeout as it takes time for the preload javascript to be loaded in the window setTimeout(() => { browserWindow.webContents.send('debug', message); }, 3000); log.info(message); } function getAppIcon() { return path.join(__dirname, '../', `/icon.${isWindows() ? 'ico' : 'png'}`);
+ 4 other calls in file
84 85 86 87 88 89 90 91 92 93
hash: function hash(_hash) { currentHash = _hash; }, 'still-ok': function stillOk() { log.info('[WDS] Nothing changed.'); if (useWarningOverlay || useErrorOverlay) overlay.clear(); sendMsg('StillOk'); }, 'log-level': function logLevel(level) {
+ 6 other calls in file
44 45 46 47 48 49 50 51 52 53
return ret } function info (msg) { const mparsed = parseMsg(msg) mlog.info(mparsed.full) } function error (msg) { const mparsed = parseMsg(msg)
4 5 6 7 8 9 10 11 12 13
const BundleSizeBot = require('./BundleSizeBot'); function runOnce() { log.enableAll(); log.info(`[${new Date().toString()}] Starting BundleSizeBot`); log.setLevel(argv.logLevel || 'error'); const bsb = new BundleSizeBot(); bsb.run(); }
286 287 288 289 290 291 292 293 294 295
}), ); } async getMessagesCount(filterCriteria = undefined) { log.info('getMessagesCount'); let author_id; if (!filterCriteria.messageId) {
loglevel.debug is the most popular function in loglevel (1470 examples)