New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Logging framework #12
Comments
Any suggestions? What would this look like? |
G3log - basic documentation, no dependencies, async (but not atomic ??? weird), linux only crash handling, code only initialization, no log level filtration except if you use a macro which slows down performance quite a bit, no utf-8 support, mediocre performance over all Spdlog - basic documentation, uses fmt library for message formatting (this is pretty cool feature imo), one of the best performants, but only if you allocate about ~150 megabytes to it (this seems wrong for our purposes, giving engine 150 more megabytes just for logging), header-only library (few of them), async not atomic Easylogging - single header lib (~6700 lines), better than basic documentation, not picky of cpu, juicy bundle of util macro, cli flags and file configs support, sync - sinks like file can be painful in bad circumstances, no level filtration looks like g3log - int main() {
int less = 1; int more = 2
LOG_IF(INFO, (less<more)) <<"If [true], then this text will be logged";
// or with printf-like syntax
LOGF_IF(INFO, (less<more), "if %d<%d then this text will be logged", less,more);
} Spdlog - #include "spdlog/spdlog.h"
#include "spdlog/sinks/basic_file_sink.h"
int main()
{
spdlog::info("Welcome to spdlog!");
spdlog::error("Some error message with arg: {}", 1);
spdlog::warn("Easy padding in numbers like {:08d}", 12);
spdlog::critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42);
spdlog::info("Positional args are {1} {0}..", "too", "supported");
spdlog::set_level(spdlog::level::debug); // Set global log level to debug
} Easylogging - #include "easylogging++.h"
INITIALIZE_EASYLOGGINGPP //thread-safe macro
int main(int argc, const char** argv) {
el::Configurations defaultConf;
defaultConf.setToDefault();
// Values are always std::string
defaultConf.set(el::Level::Info,
el::ConfigurationType::Format, "%datetime %level %msg");
// default logger uses default configurations
el::Loggers::reconfigureLogger("default", defaultConf);
LOG(INFO) << "Log using default file";
// To set GLOBAL configurations you may use
defaultConf.setGlobally(
el::ConfigurationType::Format, "%date %msg");
el::Loggers::reconfigureLogger("default", defaultConf);
return 0;
} I suggest using spdlog, it's pretty fast, easy to read and overall a good choice. If everyone agrees on it then I'm going to add logging to novelrt. |
Please note whatever logging framework we use MUST be available via vcpkg. |
What would you prefer? |
Well, from searches for benchmarks I've done, it appears that top 3 are glog, g3log, and spdlog. Arkrait pretty much hit the nail on the head with the latter two, with glog being the predecessor to g3log - APIs are very similar, but glog is synchronous. Also, since it uses macros, there may be a slight issue if we ever need to pull in a Windows dependency (it defines Overall, I think spdlog is the best choice. I'm not quite sure about the allocation issue as mentioned before, but I feel it would be best for our needs. Sounds good? |
LGTM, let's do it. |
So, to recap: -Spdlog will be logging framework of choice. |
Yep that sounds right. |
Sounds silly, but last question - would we want to create a service for this? Or just effectively replace the standard calls for now? |
Definitely a "service". Anyone, including people using |
Thanks for the clarification! That's the route I wanted to head, but I just wanted to be sure. |
We should probably think about proper logging for the runtime, as logging is incredibly important for projects of any size
AB#3
The text was updated successfully, but these errors were encountered: