Permalink
Browse files

making OTCLI-based tools use an env OTCETERA_LOGFILE as a means of ov…

…erriding ./logs/myeasylog.log as the default
  • Loading branch information...
1 parent df5921f commit 4956c81a5328c96df7c4b6974b20ca6d6f6ac45a @mtholder committed Mar 27, 2016
Showing with 7 additions and 0 deletions.
  1. +7 −0 otc/otcli.cpp
View
@@ -2,6 +2,7 @@
#include <cstring>
#include <string>
#include <vector>
+#include <cstdlib>
///////////////////////////////////////////////////////////////
// pragmas are MTH mods to silence clang
@@ -43,6 +44,12 @@ OTCLI::OTCLI(const char *title,
defaultConf.set(el::Level::Trace, el::ConfigurationType::Enabled, "false");
defaultConf.set(el::Level::Debug, el::ConfigurationType::Enabled, "false");
}
+ auto logFilePath = std::getenv("OTCETERA_LOGFILE");
+ if (logFilePath) {
+ defaultConf.set(el::Level::Global, el::ConfigurationType::Filename, logFilePath);
+ } else {
+ std::cerr << "Not setting logFilePath\n";
+ }
el::Loggers::reconfigureLogger("default", defaultConf);
}

0 comments on commit 4956c81

Please sign in to comment.