Usage
Getting started
To log messages and data, we need to create two objects:
A
MessageLog
, which stores a message and any associated data that we want to log.A
CodenicLogger
, which enables us to log the contents of a MessageLog in a formatted structure.
For example:
Different Log levels
The CodenicLogger
offers multiple log levels, each with a different color to make them easier to spot in the console. This can help you quickly identify and locate important log messages.
Logging an Exception
To log an error together with its stack trace, you can pass it to the logger. This can help you troubleshoot and diagnose issues more effectively.
Setting a user ID
When a user ID is provided, it will automatically be included in the log data.
To remove the user ID, simply set it back to null
:
Last updated