How to use Fastify’s logger
Application logging is one of the pillars of application observability. It provides useful information to understand what the system is doing and narrow down where the bug arises. A good logging setup has the following qualities:
- Consolidate: This sends the logs to a designated output.
- Structure: This provides a format to query and analyze over text messages.
- Context: This adds metadata based on the execution environment.
- Security: This applies filter and data reduction to hide sensitive information.
- Verbosity: This sets the log severity based on the environment. Unfortunately, logging is not free, as it costs the system’s resources, so we can’t just log everything without impacting the application’s performance.
Generally, you can easily understand whether application logs are implemented correctly or not. But you should never underestimate the importance of logging.
In fact, when you are having...