Logging
Octoris has built in functionality that allows you to take advantage of logging within the framework.
Using Logging
You can use the logger by first initializing it within the composeRoutes
function you can pass it true
as a value to just use the default setup like so
The logger uses the Pino package to do the actual logging check it's documentation for the different functions it has available.
You can also pass the logger a options object that follows the pino options object
If you provide a file
option octoris will automatically use the pino.destination()
functionality to make sure your logs are written to that file
Logging From Context
If you setup and decide to use the logger built into octoris, you then have it available to you from the context object passed to your routes and middleware.
You can checkout the different logger methods available within the pino documentation
Last updated