Most real-world applications require some sort of logging functionality. At the very least we want to log any errors that happen in our application. This will allow us to go back and trace the cause of the errors if they happen in production.
Several logging options are available. In this section we’ll use the Timbre library. First, we’ll need to include it in our project file:
Then we can start using it by requiring it in our namespace and calling the trace debug, info, warn, error, and fatal functions. Let’s add logging to the upload namespace and log errors if an exception occurs when we try to delete a file.