🔥More exclusive content: https://productioncoder.com/you-decide-what-we-build-next
Twitter: https://twitter.com/_jgoebel
Blog: https://productioncoder.com
Website: https://jangoebel.com
Code: https://github.com/productioncoder/node-winston-logging
In this video we cover how to use winston - a Node logging library to create a custom logger. We cover what winston transports are, how to use them and how you should approach logging when running locally and in production. With the winston logging library you have very fine-grained control over how and where logs are written out to. We also cover json logging with winston and how to set your logger up for production use.
00:00 what problem does winston solve?
01:18 winston transports in Node
02:42 log levels in winston
04:17 console.log in detail
05:00 setting up a simple winston logger
08:13 setting the logging level globally
10:04 creating a custom log format in winston
12:05 how to add timestamps to winston logs
15:45 colorizing logger output in winston
16:40 logging stack traces with winston
18:22 adding metadata to winston logs
19:30 creating a production-ready winston logger with json formatting
23:40 dynamically creating your logger depending on the node environment
26:30 trying out our winston production logger
27:56 conclusion