Skip to content

Commit 8952138

Browse files
Polish
1 parent ceb98f7 commit 8952138

File tree

2 files changed

+13
-20
lines changed

2 files changed

+13
-20
lines changed

src/net/config/ConfigInstance.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343

4444
#ifndef DOXYGEN_SHOULD_SKIP_THIS
4545

46-
#include "log/Logger.h"
4746
#include "utils/Config.h"
4847

4948
#include <cstddef>
@@ -174,16 +173,6 @@ namespace net::config {
174173
CLI::App* sectionSc = instanceSc->get_subcommand_no_throw(name);
175174
CLI::App* parentSectionSc = instanceSc->get_parent()->get_subcommand_no_throw(name);
176175

177-
if (sectionSc != nullptr) {
178-
VLOG(0) << "----------- Origin: " << sectionSc->get_name() << " " << sectionSc << ", C: " << sectionSc->count()
179-
<< " CA: " << sectionSc->count_all() << ", OnlyGot: " << onlyGot;
180-
}
181-
182-
if (parentSectionSc != nullptr) {
183-
VLOG(0) << "----------- Parent: " << parentSectionSc->get_name() << " " << parentSectionSc
184-
<< ", C: " << parentSectionSc->count() << " CA: " << parentSectionSc->count_all() << ", OnlyGot: " << onlyGot;
185-
}
186-
187176
if (sectionSc != nullptr && (sectionSc->count_all() > 0 || !onlyGot)) {
188177
resultSc = sectionSc;
189178
} else if (recursive && parentSectionSc != nullptr && (parentSectionSc->count_all() > 0 || !onlyGot)) {

src/utils/Config.cpp

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -607,9 +607,11 @@ namespace utils {
607607
}
608608
}
609609
} catch (const DaemonError& e) {
610-
std::cout << "Daemon error: " << e.what() << " ... exiting" << std::endl;
610+
std::cout << "1[" << Color::Code::FG_RED << "Error" << Color::Code::FG_DEFAULT << "] Daemonize: " << e.what()
611+
<< " ... exiting" << std::endl;
611612
} catch (const DaemonFailure& e) {
612-
std::cout << "Daemon failure: " << e.what() << " ... exiting" << std::endl;
613+
std::cout << "2[" << Color::Code::FG_RED << "Failure" << Color::Code::FG_DEFAULT << "] Daemonize: " << e.what()
614+
<< " ... exiting" << std::endl;
613615
} catch (const DaemonSignaled& e) {
614616
std::cout << "Pid: " << getpid() << ", child pid: " << e.getPid() << ": " << e.what() << std::endl;
615617
} catch (const CLI::CallForHelp&) {
@@ -635,7 +637,8 @@ namespace utils {
635637
try {
636638
std::cout << e.getApp()->config_to_str(true, true);
637639
} catch (const CLI::ParseError& e1) {
638-
std::cout << "Error showing config file: " << e.getApp() << " " << e1.get_name() << " " << e1.what() << std::endl;
640+
std::cout << "3[" << Color::Code::FG_RED << "Error" << Color::Code::FG_DEFAULT
641+
<< "] Showing config file: " << e.getApp() << " " << e1.get_name() << " " << e1.what() << std::endl;
639642
throw;
640643
}
641644
} catch (const CLI::CallForWriteConfig& e) {
@@ -651,23 +654,24 @@ namespace utils {
651654
throw;
652655
}
653656
} else {
654-
std::cout << "Error writing config file: " << std::strerror(errno) << std::endl;
657+
std::cout << "4[" << Color::Code::FG_RED << "Error" << Color::Code::FG_DEFAULT
658+
<< "] Writing config file: " << std::strerror(errno) << std::endl;
655659
}
656660
} catch (const CLI::ConversionError& e) {
657-
std::cout << "[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << "] " << e.what() << std::endl;
661+
std::cout << "5[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << "] " << e.what() << std::endl;
658662
throw;
659663
} catch (const CLI::ArgumentMismatch& e) {
660-
std::cout << "[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << "] " << e.what() << std::endl;
664+
std::cout << "6[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << "] " << e.what() << std::endl;
661665
throw;
662666
} catch (const CLI::ConfigError& e) {
663-
std::cout << "[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << "] " << e.what() << std::endl;
667+
std::cout << "7[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << "] " << e.what() << std::endl;
664668
std::cout << " Adding '-w' on the command line may solve this problem" << std::endl;
665669
throw;
666670
} catch (const CLI::ParseError& e) {
667671
const std::string what = e.what();
668672
if (what.find("[Option Group: ") != std::string::npos) { // If CLI11 throws that error it means for us there are
669673
// unconfigured anonymous instances
670-
std::cout << Color::Code::FG_RED << "[BootstrapError]" << Color::Code::FG_DEFAULT
674+
std::cout << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT
671675
<< " Anonymous instance(s) not configured in source code " << std::endl;
672676
} else {
673677
std::cout << "[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << "] " << what << std::endl;
@@ -677,7 +681,7 @@ namespace utils {
677681
} catch ([[maybe_unused]] const CLI::ParseError& e) {
678682
std::cout << std::endl << "Append -h or --help to your command line for more information." << std::endl;
679683
} catch (const CLI::Error& e) {
680-
std::cout << "[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << " ] " << e.what() << std::endl;
684+
std::cout << "[" << Color::Code::FG_RED << e.get_name() << Color::Code::FG_DEFAULT << "] " << e.what() << std::endl;
681685

682686
std::cout << std::endl << "Append -h or --help to your command line for more information." << std::endl;
683687
}

0 commit comments

Comments
 (0)