How to use the info function from winston
Find comprehensive JavaScript winston.info code examples handpicked from public code repositorys.
winston.info is a method provided by the Winston logging library to log an informational message to a logger instance.
78 79 80 81 82 83 84 85 86 87 88
/* * Mock route, for GET edition */ router.get(`${ENDPOINT}/edition`, (req, res) => { winston.info('Mock TKG UI GET EDITION API: ' + appConfig.edition); res.status(200); res.json(appConfig.edition); });
+ 57 other calls in file
195 196 197 198 199 200 201 202 203 204
if (rowCount >= maxRows) { // Make sure we grow at least by requestlength. // Add MAX_ROW_BUFFER_INCREASE in addition to give headroom for more requests before // having to resize again const requestLen = requestCopy.requests ? requestCopy.requests.length : 0; winston.info(`Expanding max rows: ${maxRows} to ` + `${maxRows + requestLen + MAX_ROW_BUFFER_INCREASE}`, request.webhookId); maxRows = maxRows + requestLen + MAX_ROW_BUFFER_INCREASE; if (maxRows > maxPossibleRows) { winston.info(`Resetting back to max possible rows`, request.webhookId);
+ 31 other calls in file
How does winston.info work?
winston.info is a method provided by the winston logging library that creates a log entry with a "info" level severity, allowing the developer to output information or messages to the log that are considered normal or expected. When called, winston.info typically takes a message string and additional metadata and outputs them to the console or other logging destination, depending on the transport(s) configured.
272 273 274 275 276 277 278 279 280 281
res.json({ success: false, error: "Internal server error." }); this.logError(req, res, e); } } logInfo(req, res, message, options = {}) { winston.info(message, Object.assign(Object.assign({}, options), this.requestLog(req, res))); } logError(req, res, message, options = {}) { winston.error(message, Object.assign(Object.assign({}, options), this.requestLog(req, res))); }
+ 7 other calls in file
327 328 329 330 331 332 333 334 335 336
/^ return async context => {$/a\ \/* code added by ${FileNameWithExtension} ${TimeStamp} *\/ \\ if ( _.has(context, 'data.google.profile') ){\\ if ( _.has(context.data.google.profile, 'displayName' ) ) {\\ context.data.displayName = context.data.google.profile.displayName;\\ logger.info('displayName: ' + context.data.displayName); \\ }\\ if ( _.has(context.data.google.profile, 'emails' ) ) {\\ context.data.email = context.data.google.profile.emails.find(email => email.value).value;\\ logger.info('email: ' + context.data.email);\\
+ 23 other calls in file
Ai Example
1 2 3 4 5 6 7 8 9
const winston = require("winston"); // Create a logger with a console transport const logger = winston.createLogger({ transports: [new winston.transports.Console()], }); // Log an informational message logger.info("This is an informational message.");
In this example, we create a new logger using winston.createLogger, and add a console transport to it. We then use logger.info to log an informational message to the console. The message "This is an informational message." will be output to the console, along with a timestamp and other metadata.
42 43 44 45 46 47 48 49 50 51
routes(app) port = config.port || 80 server = app.listen(port, function () { logger.info('Express integrator-extension server listening on port: ' + port) return callback() }) app.set('__server_ready__', true) app.set('__server_live__', true)
+ 5 other calls in file
GitHub: trillianh/astra
73 74 75 76 77 78 79 80 81 82 83 84
logger.info('Connected'); }); bot.on('disconnect', function (erMsg, code) { logger.info('Disconnected'); logger.info(code + " " + erMsg); }); bot.on('messageCreate', messageObj => { let message = messageObj.content;
+ 95 other calls in file
GitHub: jcsombria/ReNoLabs
207 208 209 210 211 212 213 214 215 216
// res.status(400).send(error); // } // }, // views: { // get: function (req, res) { // logger.info( // "Sending view...With great power comes great responsibility!" // ); // const v = models.View.findAll() // .then((result) => {
+ 74 other calls in file
GitHub: jcsombria/ReNoLabs
275 276 277 278 279 280 281 282 283 284
return this.active; } _timeout() { this.end(); logger.info(`Session expired - ${new Date()}`); } _disconnectTimeout() { this.end();
+ 14 other calls in file
GitHub: HomieOmie/nodebb-temp
82 83 84 85 86 87 88 89 90 91 92 93
winston.verbose('[plugins] Initializing plugins system'); } await Plugins.reload(); if (global.env === 'development') { winston.info('[plugins] Plugins OK'); } Plugins.initialized = true; };
+ 16 other calls in file
GitHub: HomieOmie/nodebb-temp
81 82 83 84 85 86 87 88 89 90 91 92
} } function printStartupInfo() { if (nconf.get('isPrimary')) { winston.info('Initializing NodeBB v%s %s', nconf.get('version'), nconf.get('url')); const host = nconf.get(`${nconf.get('database')}:host`); const storeLocation = host ? `at ${host}${!host.includes('/') ? `:${nconf.get(`${nconf.get('database')}:port`)}` : ''}` : '';
+ 90 other calls in file
27 28 29 30 31 32 33 34 35 36 37
try { const fs = require('fs'); const configJSON = fs.readFileSync(path.join(__dirname, '../../config.json'), 'utf-8'); winston.info('configJSON'); winston.info(configJSON); } catch (err) { console.error(err.stack); throw err; }
+ 103 other calls in file
GitHub: HomieOmie/nodebb-temp
64 65 66 67 68 69 70 71 72 73
}; // Set setup values from env vars (if set) const envKeys = Object.keys(process.env); if (Object.keys(envConfMap).some(key => envKeys.includes(key))) { winston.info('[install/checkSetupFlagEnv] checking env vars for setup info...'); setupVal = setupVal || {}; Object.entries(process.env).forEach(([evName, evValue]) => { // get setup values from env if (evName.startsWith('NODEBB_DB_')) {
+ 19 other calls in file
GitHub: newfreespsace/nsoj
84 85 86 87 88 89 90 91 92 93
const initializeNamespace = (name, exec) => { if (debug) winston.debug('initializing socketIO', name); const newNamespace = ioInstance.of('/' + name); newNamespace.on('connection', (socket) => { socket.on('disconnect', () => { if (debug) winston.info(`Client ${socket.id} disconnected.`); delete clientDisplayConfigList[socket.id]; if (clientDetailProgressList[socket.id]) { delete clientDetailProgressList[socket.id]; }
+ 2 other calls in file
36 37 38 39 40 41 42 43 44 45
create(body, (err, results) => { if (err) { status500(res, err); } winston.info('New user created') return res.status(200).send(results); }); }, updateUser: async (req, res) => {
+ 53 other calls in file
59 60 61 62 63 64 65 66 67 68
data.user["company_id"] = company.id let user = await User.create(data.user) await tools.defaultDataService(company.id) Logger.info(`Register: ${user, company}`) if (user && company) { return { user: user,
+ 2 other calls in file
31 32 33 34 35 36 37 38 39 40
data["invoice_template_id_fr"] = 3 data["estimate_template_id_fr"] = 4 data["invoice_template_id_ar"] = 5 data["estimate_template_id_ar"] = 6 let company = await Company.create(data); Logger.info('create company', company) return company } else { throw new Errors.InvalidDataError('missing data') }
+ 13 other calls in file
winston.format is the most popular function in winston (1147 examples)