// Optional, but useful to time-stamp the start of the log. // Will also detect verbosity level on command line as -v. // loguru::init(argc, argv);
// Put every log message in "everything.log": loguru::add_file("everything.log", loguru::Append, loguru::Verbosity_MAX);
// Only log INFO, WARNING, ERROR and FATAL to "latest_readable.log": loguru::add_file("latest_readable.log", loguru::Truncate, loguru::Verbosity_INFO);
// Only show most relevant things on stderr: // loguru::g_stderr_verbosity = 1;
LOG_SCOPE_F(INFO, "Will indent all log messages within this scope."); LOG_F(INFO, "I'm hungry for some %.3f!", 3.14159); LOG_F(2, "Will only show if verbosity is 2 or higher"); // VLOG_F(get_log_level(), "Use vlog for dynamic log level (integer in the range 0-9, inclusive)"); LOG_IF_F(ERROR, true, "Will only show if badness happens"); // auto fp = fopen(filename, "r"); std::string a = "Here is a string."; //CHECK_F(1 == 0, "Assertion 1 == 0 failed.\n '%s'\n '%d' ", a.c_str(), 1000); /// CHECK_GT_F(length, 0); // Will print the value of `length` on failure. /// CHECK_EQ_F(a, b, "You can also supply a custom message, like to print something: %d", a + b);
// Each function also comes with a version prefixed with D for Debug: /// DCHECK_F(expensive_check(x)); // Only checked #if !NDEBUG DLOG_F(INFO, "Only written in debug-builds");
// Turn off writing to stderr: loguru::g_stderr_verbosity = loguru::Verbosity_OFF;
// Turn off writing err/warn in red: loguru::g_colorlogtostderr = false; return0; }