Replies: 1 comment 1 reply
-
Since we're using Qt, why would we not just use Qt's logging features? It can be made to log to a file through We can already use it in similar fashion: qInfo() << "This is an INFO level log"; // no need to do std::endl
qDebug() << "DEBUG statement"; |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, we can only log (to console or file) by including
#iostream
and using std::cout. I propose we use a logger so we can easily log to a file or to stdout.I'm a big fan of g3log: https://github.com/KjellKod/g3log. It allows you to define your own sinks (file, stdout, etc) and your own syntax & colors for every log level (INFO, DEBUG, ERROR, WARN, TRACE, etc...), including the file and linenumber where the log is called.
Here's an example in my connect4 deep RL engine project: https://github.com/zjeffer/connect4-deep-rl/tree/main/src/logger
This can be used like so:
This would be incredibly useful for development & debugging purposes, and people could maybe pass a --debug argument to enable the DEBUG/TRACE level when reporting bugs/crashes?
Beta Was this translation helpful? Give feedback.
All reactions