Skip to content

Commit

Permalink
Add space between info.message and meta.message (#1740)
Browse files Browse the repository at this point in the history
* Update logger.js

* fix tests
  • Loading branch information
rap2hpoutre authored Jun 22, 2020
1 parent ef97171 commit 227ca0a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/winston/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ class Logger extends Transform {
message: msg
});

if (meta.message) info.message += `${meta.message}`;
if (meta.message) info.message = `${info.message} ${meta.message}`;
if (meta.stack) info.stack = meta.stack;

this.write(info);
Expand Down
8 changes: 4 additions & 4 deletions test/formats/errors.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ describe('format.errors (integration)', function () {
format.printf(info => info.message)
));

logger.log('info', 'Caught error: ', new Error('Errors lack .toJSON() lulz'));
logger.log('info', 'Caught error:', new Error('Errors lack .toJSON() lulz'));
});

it('logger.log(level, msg, meta<error>) [custom error properties]', (done) => {
Expand All @@ -132,7 +132,7 @@ describe('format.errors (integration)', function () {
format.printf(info => info.message)
));

logger.log('info', 'Caught error: ', err);
logger.log('info', 'Caught error:', err);
});

it('logger.<level>(error)', (done) => {
Expand Down Expand Up @@ -209,7 +209,7 @@ describe('format.errors (integration)', function () {
format.printf(info => info.message)
));

logger.info('Caught error: ', new Error('Errors lack .toJSON() lulz'));
logger.info('Caught error:', new Error('Errors lack .toJSON() lulz'));
});

it('logger.<level>(msg, meta<error>) [custom error properties]', (done) => {
Expand All @@ -231,7 +231,7 @@ describe('format.errors (integration)', function () {
format.printf(info => info.message)
));

logger.info('Caught error: ', err);
logger.info('Caught error:', err);
});

it(`Promise.reject().catch(logger.<level>)`, (done) => {
Expand Down

0 comments on commit 227ca0a

Please sign in to comment.