Add a proper logging system #12
Labels
enhancement
New feature or request
good first issue
Good for newcomers
help wanted
Extra attention is needed
Due to the complexity of a game engine, logging is pretty much required to keep track of what's going on. Currently, everything is written directly to the standard outputs using
std::cout
andstd::cerr
. A proper logging system would instead allow us to write log messages anywhere (e.g. to a file on disk, send them over the network, or display them in an in-game console).Most game engines have some way handling logging with various levels of verbosity. The most common levels available are:
These levels are commonly identified by an integer like in the ordered list above. The logger then has routines to filter messages to the ones we are interested in only.
Proposed interface
Setting the current log level should probably be just a function call with an enum value:
An idiomatic C++ interface for logging messages could look like the following:
However, some logging libraries prefer C-style IO for performance reasons.
Either way, effort should be made to be as lazy as possible for disabled log levels. Writing to
ige::log::trace
should be as light as possible when the current logging level is lower thanTRACE
.Some popular logging libraries in the C++ world:
The text was updated successfully, but these errors were encountered: