본문으로 바로가기

github.com/pinojs/pino-pretty

 

pinojs/pino-pretty

🌲Basic prettifier for Pino log lines. Contribute to pinojs/pino-pretty development by creating an account on GitHub.

github.com

 

fastify는 기본적으로 pino를 로거로 사용한다고 한다. 그런데 이게 가독성이 좋지 않다...

pino-pretty를 이용하면 좋다.

 

 

Since Fastify is really focused on performances, it uses pino as its logger, with the default log level, when enabled, set to 'info'. - www.fastify.io/docs/v2.0.x/Logging/

{"level":30,"time":1610373961822,"pid":23100,"hostname":"DESKTOP-BL5J411","msg":"http://localhost:4002"}
{"level":30,"time":1610373961833,"pid":23100,"hostname":"DESKTOP-BL5J411","msg":"Server listening at http://127.0.0.1:4002"}   

 

A standard Pino log line like:

{"level":30,"time":1522431328992,"msg":"hello world","pid":42,"hostname":"foo","v":1}

Will format to:

[1522431328992] INFO (42 on foo): hello world

 

설치

yarn global add pino-pretty

 

CLI Arguments 추가도 꼭 해서, 다음과 같이 파이프 라인으로 연결해주면 된다 ㅎ.

"start": "nodemon --exec ts-node src/index.ts | pino-pretty -t -c"

 

 

fastify를 빠르게 시작하기 위한 보일러 플레이트도 만들어 놓았다.

 

github.com/DarrenKwonDev/fastify-quick-start

 

DarrenKwonDev/fastify-quick-start

fastify-ready-to-go! Contribute to DarrenKwonDev/fastify-quick-start development by creating an account on GitHub.

github.com

 

'Node, Nest, Deno > 🐆 fastify' 카테고리의 다른 글

fastify Getting Started! : fastify 개론  (0) 2021.01.10

darren, dev blog
블로그 이미지 DarrenKwonDev 님의 블로그
VISITOR 오늘 / 전체