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

feat: support full logs

  • Loading branch information
harrison-van committed Nov 22, 2018
commit c7561ea1a860ce105900cd9d0fbacbb3d1d6cce6
@@ -98,11 +98,19 @@ Loggly.prototype.name = 'loggly';
const validateMetadata = (meta) => {
if (meta == null) {
return {};
} else if (typeof meta !== 'object') {
}

if (typeof meta !== 'object') {
return { metadata: meta };
} else {
return clone(meta);
}

const symbols = Object.getOwnPropertySymbols(meta);
const key = symbols.find(symbol => String(symbol) === 'Symbol(message)');
if (key !== undefined) {
return clone(meta[key]);
}

return clone(meta);
};

//
@@ -115,14 +123,14 @@ const validateMetadata = (meta) => {
//
Loggly.prototype.log = function (level, msg, meta, callback) {

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

if (this.silent) {
return callback(null, true);
}

if (this.timestamp && !message.timestamp) {
message.timestamp = (new Date()).toISOString();
if (this.timestamp && !data.timestamp) {
data.timestamp = (new Date()).toISOString();
}

if (this.stripColors) {
@@ -131,8 +139,8 @@ Loggly.prototype.log = function (level, msg, meta, callback) {

const self = this;

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

//
// Helper function for responded to logging.
@@ -143,8 +151,8 @@ Loggly.prototype.log = function (level, msg, meta, callback) {
}

return (meta && meta.tags)
? this.client.log(message, meta.tags, logged)
: this.client.log(message, logged);
? this.client.log(data, meta.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.