Resolve "LOG_OUTPUT_TRUNC environment variables does not work as expected"

This MR fixes the behavior of the LOG_OUTPUT_TRUNC variable. First, it corrects a wrong comparison with integer value 0 rather than character value '0' that prevented truncation to work as expected. Second, it tweaks the code so that an undefined LOG_OUTPUT_TRUNC does not enable truncation mode.

Closes #185 (closed) #187 (closed)

Edited by Alberto Miranda

Merge request reports

Loading
+1 −1
Changes for src/client/preload_context.cpp: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -90,7 +90,7 @@ PreloadContext::init_logging() {
    const std::string trunc_val =
            gkfs::env::get_var(gkfs::env::LOG_OUTPUT_TRUNC);

    const bool log_trunc = !(!trunc_val.empty() && trunc_val[0] == 0);
    const bool log_trunc = (!trunc_val.empty() && trunc_val[0] != '0');

    gkfs::log::create_global_logger(log_opts, log_output, log_trunc
#ifdef GKFS_DEBUG_BUILD
Loading