Skip to content

Commit

Permalink
Merge pull request #86 from trojs/feature/console-format-json
Browse files Browse the repository at this point in the history
Fix formatter, do format per transport
  • Loading branch information
w3nl authored Aug 26, 2024
2 parents eaf289d + 9ff3955 commit a1d96c2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@trojs/logger",
"description": "Winston logger for TroJS",
"version": "0.5.0",
"version": "0.5.1",
"author": {
"name": "Pieter Wigboldus",
"url": "https://trojs.org/"
Expand Down
1 change: 0 additions & 1 deletion src/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ export default ({ loggers = defaultLoggers, level = 'info', meta = {} }) => {
return winston.createLogger({
level,
levels,
format: winston.format.json(),
defaultMeta: meta,
transports: winstonLoggers,
});
Expand Down
5 changes: 4 additions & 1 deletion src/loggers/console.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export default ({ winston, logger }) => {
)(),
winston.format.json()
)
: undefined,
: winston.format.combine(
winston.format.errors({ stack: logger?.debug ?? false }),
winston.format.simple()
),
});
};

0 comments on commit a1d96c2

Please sign in to comment.