How to use the createLogger function from winston
Find comprehensive JavaScript winston.createLogger code examples handpicked from public code repositorys.
43 44 45 46 47 48 49 50 51 52 53
], exceptionHandlers: [ combinedLog ] } const logger = createLogger(winstonOptions) if (isDev) { logger.info('Running the Electron app in dev mode.') }
225
731
32
+ 8 other calls in file
122 123 124 125 126 127 128 129 130 131
formatForConsole ), }); } /** @type {winston.Logger} */ const logger = winston.createLogger({ level: logLevel, format: transformNonStringMessage(), // shared format for transports. transports: [mainLogTransport], exitOnError: false,
72
140
33
+ 2 other calls in file
GitHub: ebu/pi-list
32 33 34 35 36 37 38 39 40 41
return `${timestamp} [${label}] ${level}: ${removeLastLineBreak(message)} ${ isNumber(durationMs) ? `| ${durationMs} ms`: ''}` } // Winston logger configuration const logger = winston.createLogger({ level: 'info', transports: [ // Configures the log file new winston.transports.File({
25
84
18
+ 7 other calls in file
GitHub: volumio/volumio3-backend
10 11 12 13 14 15 16 17 18 19 20
// Define the CoreCommandRouter class module.exports = CoreCommandRouter; function CoreCommandRouter (server) { metrics.time('CommandRouter'); this.logger = winston.createLogger({ format: winston.format.simple(), transports: [ new (winston.transports.Console)({level: 'verbose'}) ]
28
21
4
6 7 8 9 10 11 12 13 14 15 16
const util = require("util"); const config = require("config"); const getParams = require("get-parameter-names"); const { createLogger, format, transports } = require("winston"); const logger = createLogger({ level: config.LOG_LEVEL, transports: [ new transports.Console({ format: format.combine(format.colorize(), format.simple()),
44
17
25
+ 4 other calls in file
9 10 11 12 13 14 15 16 17 18 19
var diskCache = true; var variant = 'none'; const { v4: uuidv4 } = require('uuid'); var winston = require('winston'); var logger = winston.createLogger({ format: winston.format.simple(), transports: [ new (winston.transports.Console)(), new (winston.transports.File)({
28
21
4
+ 4 other calls in file
GitHub: brainlife/warehouse
6 7 8 9 10 11 12 13 14 15 16 17
const winston = require('winston'); const ssh2 = require('ssh2'); const gunzip = require('gunzip-stream'); const config = require('../../api/config'); const logger = winston.createLogger(config.logger.winston); const db = require('../../api/models'); console.log("connecting to db"); db.init(function(err) {
9
8
4
245 246 247 248 249 250 251 252 253 254
try { fs.truncateSync(logpath); } catch (err) { console.log("failed to truncate.. maybe first time "+logpath); } rlogger = createLogger({ format: combine( timestamp(), format.splat(), format.printf(info=>{
9
8
4
GitHub: RPSoftCompany/tower
124 125 126 127 128 129 130 131 132 133 134
return `${date.toLocaleString()}.${mili} ${level}: ${message}`; }, ); // Winston instance const logger = (module.exports = winston.createLogger({ level: logLevel, transports: [new winston.transports.Console()], format: winston.format.combine( winston.format.timestamp(),
1
8
2
+ 7 other calls in file
46 47 48 49 50 51 52 53 54 55 56 57
// }), // new (winston.transports.File)({filename: path.join(logDir, '/log.txt')}) ], } const logger = winston.createLogger(logConfiguration); // If we're not in production then log to the `console` // But this doesn't work - seeing no message in my vscode debug console during extension development? if (process.env.NODE_ENV !== 'production') {
1
2
0
GitHub: zieren/eltern-emailer
161 162 163 164 165 166 167 168 169 170 171
+ '(?:$|>)'; } } function createLogger() { return winston.createLogger({ level: CONFIG.options.logLevel, format: winston.format.combine( winston.format.splat(), winston.format.timestamp(),
1
1
1
+ 18 other calls in file
81 82 83 84 85 86 87 88 89 90 91
const logger = winston.createLogger({ level: 'info', transports: [appError, appCombined] }); const plogger = winston.createLogger({ level: 'info', transports: [protocolsLogs] }); const clogger = winston.createLogger({
1
1
1
+ 59 other calls in file
8 9 10 11 12 13 14 15 16 17 18 19 20
const InviteRenderer = require("./InviteRenderer.js"); const InviteResolver = require("./InviteResolver"); const app = express(); const logger = winston.createLogger(); if (process.env.NODE_ENV === "production") { logger.add(new winston.transports.Console({ level: process.env.LOGGING_LEVEL || "silly" })); } else {
0
1
0
GitHub: quintoandar/node-logger
25 26 27 28 29 30 31 32 33 34 35 36
debug: process.env.NODE_ENV !== 'production', release: process.env.SENTRY_RELEASE, normalizeDepth: 5, }; const winstonLogger = createLogger({ transports: winstonTransports, }); function getFunctionCaller(func) {
0
3
210
+ 4 other calls in file
52 53 54 55 56 57 58 59 60 61
*/ exports.loggerFactory = function loggerFactory(logFileDirectory, type) { const consoleLogLevel = getLogLevel() const filePathParts = logFileDirectory.split('/') addColors(customLevels.colors) return createLogger({ levels: customLevels.levels, format: combine( splat(), timestamp(),
0
1
1
GitHub: kkowa/web
13 14 15 16 17 18 19
// to use JSON format, with logging correlation. if (!otelEnabled) { loggerOptions.format = winston.format.cli(); } module.exports = winston.createLogger(loggerOptions);
0
0
0
+ 4 other calls in file
125 126 127 128 129 130 131 132 133 134
: `${[info.timestamp]} ${info.level}: ${info.message}` ) ), exitOnError: false, } const logger = winston.createLogger(logConfiguration) console.log('Logger created') logger.info( `WickrLogger setup with Log Level: ${level}, Max File Size: ${maxSize}, and Max Number of files: ${maxFiles}` )
0
0
1
+ 15 other calls in file
2 3 4 5 6 7 8 9 10 11 12
// Danger is accessible globally const match = require('micromatch'); const array = require('lodash/array'); const winston = require('winston'); const logger = module.exports = winston.createLogger({ transports: [new winston.transports.Console()], format: winston.format.combine( winston.format.colorize({ all: true }), winston.format.simple()
0
0
1
+ 15 other calls in file
21 22 23 24 25 26 27 28 29 30 31
} return `${info.timestamp} ${info.level}:${padding} ${info.message}` }) ) const errorLogger = createLogger({ level: 'error', format: logFormat, transports: [ new transports.Console()
0
0
1
+ 27 other calls in file
71 72 73 74 75 76 77 78 79 80
info: 'white', warn: 'yellow', error: 'red' }); const mainLogger = winston.createLogger({ transports: [consoleTransport, fileTransport], levels: { trace: 4, debug: 3,
0
0
1
+ 11 other calls in file
winston.format is the most popular function in winston (1147 examples)