Logging¶
By default, all log statements will be printed to the console. This works fine for development, but is not recommended for production. Instead, it is recommended that you provide a logging target that suits your application’s production environment.
Configuring Logging¶
To customize logging, subclass the Logger class and provide an instance of your class to the MetaClient Builder.
The most common behavior toggle is to change the logging level. Set the Level property to the level you desire.
You can also control the format of the tag. The tag is useful for differentiating multiple threads or instances and includes the line number, method name, and file information about the logging statement. You can customize the tag by overriding the FormatTag method.
Common Strategies¶
Disable logging¶
There is no toggle to disable logging. Instead, set the Level to Error and provide an empty implementation of the Log method.
Change logging destinations after initialization¶
You may want to change where messages are logged during the execution of your program. To do this, customize your Logger subclass to maintain the information of where, when, and how to log. This gives you full control over the structure, threading, and lifecycles of your application logging.