This repository has been archived by the owner on Sep 8, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: updates docs and example to use transports (#49)
chore: updates docs and example to use transports Co-authored-by: Bryan Shell <shellbj@users.noreply.github.com>
- Loading branch information
Showing
5 changed files
with
88 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Catalyst server log configuration | ||
|
||
The follow diagram explains how our catalyst server manages logs | ||
|
||
![threads-diagram drawio](https://user-images.githubusercontent.com/88118994/149195822-de5d33ad-f29f-48ff-840b-ce2fb41eb08a.png) | ||
|
||
## [Pino-pretty](https://github.com/pinojs/pino-pretty) logs for development mode: | ||
|
||
install pino-pretty as a development dependency. | ||
|
||
` npm install --save-dev pino-pretty ` | ||
|
||
manifest.json | ||
``` | ||
"hapi-pino": { | ||
"plugin": "require:hapi-pino", | ||
"options": { | ||
"$filter": "env.NODE_ENV", | ||
"$default": {}, | ||
"development": { | ||
"transport": { | ||
"target": "pino-pretty", | ||
"options": { | ||
"colorize": true, | ||
"translateTime": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
pass the `NODE_ENV` as following: | ||
|
||
``` | ||
NODE_ENV=development node ./examples/simple/index.js | ||
``` | ||
|
||
## [Pino/file](https://github.com/pinojs/pino/blob/HEAD/docs/transports.md#pinofile) transport logs to stdout or file for production. | ||
|
||
``` | ||
"transport": { | ||
"targets": [ | ||
{ | ||
"target": "pino/file", | ||
"options": { | ||
"destination": 1 | ||
} | ||
} | ||
] | ||
} | ||
``` | ||
|
||
## node js profile review | ||
|
||
``` | ||
clinic doctor --autocannon [ /items ] -- node --max-http-header-size=32768 ./examples/simple/index.js | ./node_modules/.bin/pino-pretty --config=./examples/simple/.pino-prettyrc | ||
``` | ||
|
||
|
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,7 +48,7 @@ | |
"translateTime": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters