Skip to content

Commit

Permalink
fix(logger): Fix logger new line character after metadata (#31)
Browse files Browse the repository at this point in the history
Fix logger new line character after metadata
  • Loading branch information
mattallty authored Mar 14, 2017
1 parent c2e7146 commit 51139ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ util.inherits(CaporalTransport, winston.Transport);

CaporalTransport.prototype.log = function (level, msg, meta, callback) {
if (meta !== null && typeof meta !== 'undefined') {
msg += "\n" + prettyjson.render(meta);
msg += "\n" + prettyjson.render(meta) + "\n";
}
const levelInt = winston.levels[level];
const stdio = levelInt <= 1 ? 'stderr' : 'stdout';
Expand Down
4 changes: 2 additions & 2 deletions tests/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('logger', () => {
const oldWrite = process.stdout.write;
process.stdout.write = write;

should(stripColor(logStr)).be.eql("foo\nfoo: bar");
should(stripColor(logStr)).be.eql("foo\nfoo: bar\n");
should(callback.called).be.ok();
should(oldWrite.called).be.ok();
});
Expand All @@ -44,7 +44,7 @@ describe('logger', () => {
const oldWrite = process.stderr.write;
process.stderr.write = write;

should(stripColor(logStr)).be.eql("foo\nfoo: bar");
should(stripColor(logStr)).be.eql("foo\nfoo: bar\n");
should(callback.called).be.ok();
should(oldWrite.called).be.ok();

Expand Down

0 comments on commit 51139ad

Please sign in to comment.