How to use winston.default:
20 21 22 23 24 25 26 27 28 29
// Logging in Aws Cloudwatch var loggerAWS = function (data, type) { var _a, _b, _c, _d; if (type === void 0) { type = "info"; } data = fixData(data); winston_1.default.add(new winston_cloudwatch_1.default({ awsOptions: { credentials: { accessKeyId: (_a = process.env) === null || _a === void 0 ? void 0 : _a.AWS_ACCESS_ID, secretAccessKey: (_b = process.env) === null || _b === void 0 ? void 0 : _b.AWS_ACCESS_KEY,
How to use winston.add:
220 221 222 223 224 225 226 227 228 229 230 231 232
return logger; } static addLogging() { winston.add(winston.transports.Logstash); } } module.exports = {
How to use winston.log:
12 13 14 15 16 17 18 19 20 21
} }); // index app.get('/profile', app.ensureAuthenticated, function(req, res) { winston.log("info", "GET /profile"); if (typeof req.user.bitbucket !== "undefined") { models.log.find({user: req.user._id}, function(err, logs) { if (err) {
How to use winston.loggers:
162 163 164 165 166 167 168 169 170 171
if (this.session_mgr) this.session_mgr.stop(); opt = this.opt = Object.assign({}, this.opt, opt); this.logger = require('./logger.js').child({category: `[${opt.port}]`}); this.logger.set_level(opt.log); this.req_logger = winston.loggers.get('reqs'); if (opt.zagent && opt.logs_settings) this.remote_logger = this.logger.create_remote(opt.logs_settings); this.reverse_lookup = null; if (opt.reverse_lookup_dns===true)
183
600
53
See more examples
How to use winston.config:
20 21 22 23 24 25 26 27 28 29 30 31
process.env.NODE_ENV = 'development'; const filename = path.join('./', 'combined.log'); const logger = winston.createLogger({ levels: winston.config.syslog.levels, format: winston.format.combine(winston.format.colorize(), winston.format.timestamp({format: 'YYYY-MM-DD HH:mm:ss'}), winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)), transports: [ new winston.transports.File({ filename: filename,
How to use winston.configure:
53 54 55 56 57 58 59 60 61 62
} if (!process.env.ACTION_HUB_SECRET) { throw new Error("No ACTION_HUB_SECRET environment variable set."); } if (process.env.ACTION_HUB_DEBUG) { winston.configure({ level: "debug", transports: [ new (winston.transports.Console)(), ],
95
47
68
See more examples
How to use winston.addColors:
24 25 26 27 28 29 30 31 32 33
timestamp: true, prettyPrint: true }) ] }); winston.addColors({ trace: 'magenta', input: 'grey', verbose: 'cyan', prompt: 'grey',
35
222
9
See more examples
How to use winston.Logger:
995 996 997 998 999 1000 1001 1002 1003 1004
method: 'POST', path: '/javascript-errors', config: { handler: function (request, reply) { if (request.payload) { var logger = new winston.Logger({ transports: [ new winston.transports.File({ level: 'info', filename: 'client-logs.log',
46
9
16
See more examples
How to use winston.verbose:
135 136 137 138 139 140 141 142 143 144
content.slice( current.index + regex.length + current[1].length ); } } catch (err) { winston.verbose(err.messsage); } } current = regex.regex.exec(content); }
How to use winston.debug:
151 152 153 154 155 156 157 158 159 160
return false; } const userDataRequestUri = `https://graph.facebook.com/${api_1.API_VERSION}/me?access_token=${accessToken}`; const userDataResponse = yield gaxios.request({ method: "GET", url: userDataRequestUri }); if (userDataResponse.data.error && userDataResponse.data.error.message) { winston.debug("Failed oauthCheck because access token was expired or due to an error: " + userDataResponse.data.error.message); return false; } return true;
95
47
68
See more examples
How to use winston.warn:
GitHub: entria/trudesk
144 145 146 147 148 149 150 151 152 153
accountsController.profile = function(req, res) { var user = req.user; var backUrl = req.header('Referer') || '/'; if (_.isUndefined(user)) { req.flash('message', 'Permission Denied.'); winston.warn('Undefined User - /Profile'); return res.redirect(backUrl); } var content = {};
380
2
5
See more examples
How to use winston.info:
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); });
192
191
47
See more examples
How to use winston.createLogger:
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
See more examples
How to use winston.transports:
112 113 114 115 116 117 118 119 120 121
if (isGoogleCloudEnv === 'true') { // Running on Google Cloud, stream logs to Stackdriver. mainLogTransport = new LoggingWinston({prefix: label}); } else { // Running locally, stream logs to stdout. mainLogTransport = new winston.transports.Console({ format: winston.format.combine( upperCaseLevel(), winston.format.timestamp(), winston.format.colorize(),
72
140
33
See more examples
How to use winston.error:
66 67 68 69 70 71 72 73 74 75
return actionForm; } } catch (err) { (0, util_1.sanitizeError)(err); winston.error(err); } // Return the login form to start over if anything goes wrong during authentication or form construction // If a user is unauthenticated they are expected to hit an error above const loginForm = formBuilder.generateLoginForm(hubRequest);
95
47
68
See more examples
How to use winston.format:
113 114 115 116 117 118 119 120 121 122
// Running on Google Cloud, stream logs to Stackdriver. mainLogTransport = new LoggingWinston({prefix: label}); } else { // Running locally, stream logs to stdout. mainLogTransport = new winston.transports.Console({ format: winston.format.combine( upperCaseLevel(), winston.format.timestamp(), winston.format.colorize(), formatForConsole
72
140
33
See more examples