You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 10, 2024. It is now read-only.
FloweyTheFlower420 edited this page Dec 16, 2021
·
2 revisions
Transports
To specify where your logs should go, use transports. Two implementations of the transporter class are provided, one for cout and another for file streams. If you need custom outputs, just implement the transporter class. Transporters are registered like this:
The level parameter specifies the lowest logging level that will be sent to the transporter (so if the level is logger::INFO, you will receive logger::INFO and logger::WARN, but not logger::DEBUG. The other parameter controls whether or not to have color. This should be true if you want colored output for cout, but should be false for file transports. For custom transporter, this should be determined by you.
Named logging
The logger also has n<level> member functions, which can be used to control the name of the logger.
Because the logger is a singleton class, sometimes you want "sub loggers" with different names. Use the copyable logger_ref class for this. You can define the name of the logger inside that class, and use it just like a normal logger.
You can create an output stream by passing in level and the name of the underlying logger_ref. From there, you can (optionally) replace the std::cout streambuf with the streambuf of the logging stream. Be careful to do this after you add your transports, as the cout_transport takes a reference to the std::cout buf.