Skip to content

Commit 0de246b

Browse files
planetchilimarkgalvan-intel
authored andcommitted
cli flag presence and better defaults for svc logging
1 parent 461fcd1 commit 0de246b

File tree

4 files changed

+10
-5
lines changed

4 files changed

+10
-5
lines changed

IntelPresentMon/CommonUtilities/cli/CliFramework.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,16 @@ namespace pmon::util::cli
8888
}
8989
Flag::operator bool() const
9090
{
91-
return (bool)*pOption_;
91+
return data_;
9292
}
9393
bool Flag::operator!() const
9494
{
9595
return !bool(*this);
9696
}
97+
bool Flag::IsPresent() const
98+
{
99+
return (bool)*pOption_;
100+
}
97101
std::function<std::string(std::string)> OptionsElement_::GetCaptureCallback_()
98102
{
99103
return [this](std::string s) -> std::string {

IntelPresentMon/CommonUtilities/cli/CliFramework.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ namespace pmon::util::cli
213213
{
214214
return pOption_->get_name();
215215
}
216+
bool IsPresent() const;
216217
private:
217218
bool data_ = false;
218219
CLI::Option* pOption_ = nullptr;

IntelPresentMon/PresentMonService/CliOptions.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ namespace clio
2626
private: Group gl_{ this, "Logging", "Control logging behavior" }; public:
2727
Option<std::string> logDir{ this, "--log-dir", "", "Enable logging to a file in the specified directory" };
2828
Option<std::string> logPipeName{ this, "--log-pipe-name", pmon::gid::defaultLogPipeBaseName, "Name of the pipe to connect to for log IPC" };
29-
Flag disableStdioLog{ this, "--disable-stdio-log", "Disable logging to stderr" };
30-
Flag disableDebuggerLog{ this, "--disable-debugger-log", "Disable logging to system debugger" };
29+
Flag enableStdioLog{ this, "--enable-stdio-log", "Disable logging to stderr" };
30+
Flag enableDebuggerLog{ this, "--enable-debugger-log", "Disable logging to system debugger" };
3131
Flag disableIpcLog{ this, "--disable-ipc-log", "Disable logging to named pipe connection" };
3232
Option<Level> logLevel{ this, "--log-level", Level::Error, "Severity to log at", logLevelTf_ };
3333

IntelPresentMon/PresentMonService/LogSetup.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ namespace logsetup
7171
if (opt.logLevel) {
7272
GlobalPolicy::Get().SetLogLevel(*opt.logLevel);
7373
}
74-
if (opt.disableStdioLog) {
74+
if (!opt.enableStdioLog) {
7575
pChannel->AttachComponent({}, "drv:std");
7676
}
77-
if (opt.disableDebuggerLog) {
77+
if (!opt.enableDebuggerLog) {
7878
pChannel->AttachComponent({}, "drv:dbg");
7979
}
8080
if (opt.logDir) {

0 commit comments

Comments
 (0)