-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
30 lines (24 loc) · 777 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
'use strict';
const moment = require('moment-timezone');
class WCWConfig {
static init(logGroupName, level, awsRegion, timeFormat, timezone) {
const winston = require('winston');
const CloudWatch = require('winston-cloudwatch');
const cloudWatchTracker = new CloudWatch({
logGroupName,
logStreamName: moment().tz(timezone).format(timeFormat),
awsRegion: process.env.AWS_DEFAULT_REGION || awsRegion,
level
});
winston.configure({
transports: [
new winston.transports.Console({
level
}),
cloudWatchTracker
]
});
return cloudWatchTracker;
}
}
module.exports = WCWConfig;