Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade Winston #1128

Merged
merged 3 commits into from
Jan 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 24 additions & 28 deletions lib/forever.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,26 +41,6 @@ function newEmitter() {
return new events2.EventEmitter2()
}

//
// Setup `forever.log` to be a custom `winston` logger.
//
forever.log = new (winston.Logger)({
transports: [
new (winston.transports.Console)()
]
});

forever.log.cli();

//
// Setup `forever out` for logEvents with `winston` custom logger.
//
forever.out = new (winston.Logger)({
transports: [
new (winston.transports.Console)()
]
});

//
// ### Export Components / Settings
// Export `version` and important Prototypes from `lib/forever/*`
Expand All @@ -79,6 +59,27 @@ forever.cli = require('./forever/cli');
//
exports.version = require('../package').version;

//
// Setup `forever.log` to be a custom `winston` logger.
//
forever.log = winston.createLogger({
transports: [
new (winston.transports.Console)()
],
levels: winston.config.cli.levels,
format: winston.format.cli(),
});

//
// Setup `forever out` for logEvents with `winston` custom logger.
//
forever.out = winston.createLogger({
format: (forever.config.get('timestamp') === 'true') ? winston.format.timestamp(): undefined,
transports: [
new winston.transports.Console(),
],
});

//
// ### function getSockets (sockPath, callback)
// #### @sockPath {string} Path in which to look for UNIX domain sockets
Expand Down Expand Up @@ -330,11 +331,6 @@ forever.load = function (options) {
forever.config.set('logstream', options.logstream);
forever.config.set('columns', options.columns);

//
// Setup timestamp to event logger
//
forever.out.transports.console.timestamp = forever.config.get('timestamp') === 'true';

//
// Attempt to see if `forever` has been configured to
// run in debug mode.
Expand Down Expand Up @@ -365,10 +361,10 @@ forever._debug = function () {

if (!debug) {
forever.config.set('debug', true);
forever.log.add(winston.transports.File, {
forever.log.add(new winston.transports.File({
level: 'silly',
filename: path.join(forever.config.get('root'), 'forever.debug.log')
});
filename: path.join(forever.config.get('root'), 'forever.debug.log'),
}));
}
};

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"object-assign": "^4.1.1",
"prettyjson": "^1.2.2",
"shush": "^1.0.0",
"winston": "~0.8.1"
"winston": "^3.4.0"
},
"devDependencies": {
"chai": "^4.2.0",
Expand Down