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

feature: winston 3.x compatibility #48

Closed
wants to merge 4 commits into from
Closed
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Prev

feature: new transport (#2)

* feat: new log api

* chore: small changes

* chore: small changes
  • Loading branch information
harrison-van committed Nov 22, 2018
commit 632d437c1ce2824baca5f973fe17a95feb485e89
@@ -114,16 +114,14 @@ const validateMetadata = (meta) => {
};

//
// ### function log (level, msg, [meta], callback)
// #### @level {string} Level at which to log the message.
// #### @msg {string} Message to log
// #### @meta {Object} **Optional** Additional metadata to attach
// ### function log (metadata, callback)
// #### @metadata {Object} Information to attach.
// #### @callback {function} Continuation to respond to when complete.
// Core logging method exposed to Winston. Metadata is optional.
// Core logging method exposed to Winston.
//
Loggly.prototype.log = function (level, msg, meta, callback) {
Loggly.prototype.log = function (metadata, callback) {

const data = validateMetadata(meta);
const data = validateMetadata(metadata);

if (this.silent) {
return callback(null, true);
@@ -134,14 +132,11 @@ Loggly.prototype.log = function (level, msg, meta, callback) {
}

if (this.stripColors) {
msg = ('' + msg).replace(code, '');
data.message = ('' + data.message).replace(code, '');
}

const self = this;

data.level = level;
data.message = msg || data.message;

//
// Helper function for responded to logging.
//
@@ -150,8 +145,8 @@ Loggly.prototype.log = function (level, msg, meta, callback) {
callback(err, true);
}

return (meta && meta.tags)
? this.client.log(data, meta.tags, logged)
return (data && data.tags)
? this.client.log(data, data.tags, logged)
: this.client.log(data, logged);
};

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.