Skip to content

Commit

Permalink
Merge pull request #342 from byu-oit/fix/pretty
Browse files Browse the repository at this point in the history
fix: error with pretty-print and jest
  • Loading branch information
yoshutch authored Dec 11, 2023
2 parents d2f92f8 + d283b16 commit 4f612b1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@byu-oit/logger",
"version": "0.4.0",
"version": "0.4.1",
"description": "Default configuration for pino logger",
"contributors": [
{
Expand Down
6 changes: 4 additions & 2 deletions src/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export function ByuLogger (options?: LoggerOptions): Logger {
paths: ['req.headers.authorization', 'req.headers.assertion', 'req.headers["x-jwt-assertion"]', 'req.headers["x-jwt-assertion-original"]'],
censor: '***'
},
// if in local environment try to pretty print logs
...!isProduction() && isInstalled('pino-pretty') && {
// if in local environment and not running tests try to pretty print logs
// jest and pretty-print don't get along (causes open handles and sometimes doesn't close),
// so we'll default to not include pretty-print if running tests
...!isProduction() && process.env.NODE_ENV !== 'test' && isInstalled('pino-pretty') && {
transport: {
target: 'pino-pretty',
options: { translateTime: 'UTC:yyyy-mm-dd\'T\'HH:MM:ss.l\'Z\'' }
Expand Down

0 comments on commit 4f612b1

Please sign in to comment.