Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable file logging by default in Linux server. #129

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/common/server/NetRemoteServerConfiguration.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ ConfigureCliAppOptions(CLI::App& app, NetRemoteServerConfiguration& config)
config.LogVerbosity,
"The log verbosity level. Supply multiple times to increase verbosity (0=warnings, errors, and fatal messages, 1=info messages, 2=debug messages, 3=verbose messages)");

app.add_flag(
"--enable-file-logging",
config.EnableFileLogging,
"Enable logging to file (disabled by default)");

return app;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ struct NetRemoteServerConfiguration
* and a level of 3 or above will show all verbose messages.
*/
uint32_t LogVerbosity{ 0 };

/**
* @brief Whether to enable logging to file or not.
*/
bool EnableFileLogging{ false };

/**
* @brief Access point manager instance.
Expand Down
9 changes: 5 additions & 4 deletions src/linux/server/Main.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ main(int argc, char *argv[])

// Configure logging, appending all loggers to the default instance.
plog::init<notstd::to_underlying(LogInstanceId::Console)>(logSeverity, &colorConsoleAppender);
plog::init<notstd::to_underlying(LogInstanceId::File)>(logSeverity, &rollingFileAppender);
plog::init(logSeverity)
.addAppender(plog::get<notstd::to_underlying(LogInstanceId::Console)>())
.addAppender(plog::get<notstd::to_underlying(LogInstanceId::File)>());
plog::init(logSeverity).addAppender(plog::get<notstd::to_underlying(LogInstanceId::Console)>());
if (configuration.EnableFileLogging) {
plog::init<notstd::to_underlying(LogInstanceId::File)>(logSeverity, &rollingFileAppender);
plog::init(logSeverity).addAppender(plog::get<notstd::to_underlying(LogInstanceId::File)>());
}

// Create an access point manager and discovery agent.
{
Expand Down
Loading