Skip to content
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
10 changes: 5 additions & 5 deletions src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ namespace config {
if (*begin_val == '[') {
endl = skip_list(begin_val + 1, end);
if (endl == end) {
std::cout << "Warning: Config option ["sv << to_string(begin, end_name) << "] Missing ']'"sv;
BOOST_LOG(warning) << "config: Missing ']' in config option: " << to_string(begin, end_name);

return std::make_pair(endl, std::nullopt);
}
Expand Down Expand Up @@ -988,7 +988,7 @@ namespace config {

// The list needs to be a multiple of 2
if (list.size() % 2) {
std::cout << "Warning: expected "sv << name << " to have a multiple of two elements --> not "sv << list.size() << std::endl;
BOOST_LOG(warning) << "config: expected "sv << name << " to have a multiple of two elements --> not "sv << list.size();
return;
}

Expand Down Expand Up @@ -1018,7 +1018,7 @@ namespace config {
config::sunshine.flags[config::flag::UPNP].flip();
break;
default:
std::cout << "Warning: Unrecognized flag: ["sv << *line << ']' << std::endl;
BOOST_LOG(warning) << "config: Unrecognized flag: ["sv << *line << ']' << std::endl;
ret = -1;
}

Expand All @@ -1044,7 +1044,7 @@ namespace config {
}

for (auto &[name, val] : vars) {
std::cout << "["sv << name << "] -- ["sv << val << ']' << std::endl;
BOOST_LOG(info) << "config: '"sv << name << "' = "sv << val;
}

int_f(vars, "qp", video.qp);
Expand Down Expand Up @@ -1425,7 +1425,7 @@ namespace config {
shell_exec_info.nShow = SW_NORMAL;
if (!ShellExecuteExW(&shell_exec_info)) {
auto winerr = GetLastError();
std::cout << "Error: ShellExecuteEx() failed:"sv << winerr << std::endl;
BOOST_LOG(error) << "Failed executing shell command: " << winerr << std::endl;
return 1;
}

Expand Down
9 changes: 5 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@ int main(int argc, char *argv[]) {

mail::man = std::make_shared<safe::mail_raw_t>();

if (config::parse(argc, argv)) {
return 0;
}

auto log_deinit_guard = logging::init(config::sunshine.min_log_level, config::sunshine.log_file);
if (!log_deinit_guard) {
BOOST_LOG(error) << "Logging failed to initialize"sv;
Expand All @@ -123,6 +119,11 @@ int main(int argc, char *argv[]) {
// Log publisher metadata
log_publisher_data();

// parse config file
if (config::parse(argc, argv)) {
return 0;
}

if (!config::sunshine.cmd.name.empty()) {
auto fn = cmd_to_func.find(config::sunshine.cmd.name);
if (fn == std::end(cmd_to_func)) {
Expand Down