Skip to content
Snippets Groups Projects
Commit 96fb0d24 authored by Felix Weiglhofer's avatar Felix Weiglhofer
Browse files

cbmreco: Add flag to write logs to file.

parent 0b8868bd
No related branches found
No related tags found
1 merge request!1181cbmreco: Add flag to write logs to file.
...@@ -54,7 +54,9 @@ Options::Options(int argc, char** argv) ...@@ -54,7 +54,9 @@ Options::Options(int argc, char** argv)
"set log level (debug, info, warning, error, fatal)") "set log level (debug, info, warning, error, fatal)")
("monitor,m", po::value(&fMonitorUri)->value_name("<uri>")->implicit_value("file:cout"), ("monitor,m", po::value(&fMonitorUri)->value_name("<uri>")->implicit_value("file:cout"),
"URI specifying monitor output (e.g. file:/tmp/monitor.txt, influx1:login:8086:cbmreco_status). Prints to cout when no argument is given. Monitor is disabled when flag is not set.") "URI specifying monitor output (e.g. file:/tmp/monitor.txt, influx1:login:8086:cbmreco_status). Prints to cout when no argument is given. Monitor is disabled when flag is not set.")
("num-ts,n", po::value(&fNumTimeslices)->default_value(-1)->value_name("<num>"), ("log-file,f", po::value(&fLogFile)->value_name("<file>"),
"write log messages to file")
("num-ts,n", po::value<int>(&fNumTimeslices)->default_value(-1)->value_name("<num>"),
"Stop after <num> timeslices (-1 = all)") "Stop after <num> timeslices (-1 = all)")
("skip-ts,s", po::value(&fSkipTimeslices)->default_value(0)->value_name("<num>"), ("skip-ts,s", po::value(&fSkipTimeslices)->default_value(0)->value_name("<num>"),
"Skip first <num> timeslices") "Skip first <num> timeslices")
......
...@@ -21,6 +21,7 @@ namespace cbm::algo ...@@ -21,6 +21,7 @@ namespace cbm::algo
fs::path ParamsDir() const { return fParamsDir; } fs::path ParamsDir() const { return fParamsDir; }
const std::string& InputLocator() const { return fInputLocator; } const std::string& InputLocator() const { return fInputLocator; }
severity_level LogLevel() const { return fLogLevel; } severity_level LogLevel() const { return fLogLevel; }
fs::path LogFile() const { return fLogFile; }
const std::string& Device() const { return fDevice; } const std::string& Device() const { return fDevice; }
const std::string& MonitorUri() const { return fMonitorUri; } const std::string& MonitorUri() const { return fMonitorUri; }
bool CollectKernelTimes() const { return fCollectKernelTimes; } bool CollectKernelTimes() const { return fCollectKernelTimes; }
...@@ -31,6 +32,7 @@ namespace cbm::algo ...@@ -31,6 +32,7 @@ namespace cbm::algo
std::string fParamsDir; // TODO: can we make this a std::path? std::string fParamsDir; // TODO: can we make this a std::path?
std::string fInputLocator; std::string fInputLocator;
severity_level fLogLevel; severity_level fLogLevel;
std::string fLogFile;
std::string fDevice; std::string fDevice;
std::string fMonitorUri; std::string fMonitorUri;
bool fCollectKernelTimes = false; bool fCollectKernelTimes = false;
......
...@@ -19,6 +19,8 @@ int main(int argc, char** argv) ...@@ -19,6 +19,8 @@ int main(int argc, char** argv)
logging::add_console(opts.LogLevel()); logging::add_console(opts.LogLevel());
if (!opts.LogFile().empty()) logging::add_file(opts.LogFile().string(), opts.LogLevel());
// XPU // XPU
xpu::settings settings; xpu::settings settings;
settings.profile = opts.CollectKernelTimes(); settings.profile = opts.CollectKernelTimes();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment