-
Notifications
You must be signed in to change notification settings - Fork 2
Logging
Cisco edited this page Oct 4, 2025
·
1 revision
We didn't consider using a specific library
- Log4cpp has similar features to Java Log4J
- Glog : no longer maintained
- Abseil : c++17, not compatible yet looks interesting (custom sinks, structured logging, ..)
- ng-log : c++14, not compatible
Although it could have proven relevant to use an existing tool, we deemed more interesting and flexible to write our own logger.
cf. Logger and LogManager
Features
- level-controlled
-
debugfor development -
info,warninganderrorfor production
-
- file logging
- specialized loggers to store in different files
- singletons
- macros to shorten call
- setting a global minimal level
In the program flow, we want to log
- Fatal errors -> ERROR
- Raw messages being sent and received -> INFO
- Result of various checks
- syntaxically incorrect command
Classes like ReplyHandler were good points to centralize logging and prevent superfluous logging, which has a performance impact
- time
- log level (colorized)
- message
Overloads to pass objects Catching the file and function
Integrate logging into your c++ project 12 logging best practices