add braces

This commit is contained in:
Oliver 2022-10-20 01:57:59 +02:00
parent 105aac9451
commit fbc252701a
Signed by untrusted user: okaestne
GPG Key ID: 06A81B143EA9588F
1 changed files with 12 additions and 7 deletions

19
Log.cpp
View File

@ -78,10 +78,11 @@ private:
if (os) {
// print colors if enabled
if (coloredOutput)
if (coloredOutput) {
*os << "\x1B[" << color_codes[static_cast<int>(lvl)] << sbuf << "\x1B[0m";
else
} else {
*os << sbuf;
}
os->put('\n');
}
@ -89,14 +90,16 @@ private:
virtual std::ostream* getOs(Level lvl) {
// out of scope?
if (lvl == Level::off || lvl > lvl_max)
if (lvl == Level::off || lvl > lvl_max) {
return nullptr;
}
// stderr for fatal, error, warn
if (lvl <= Level::warn)
if (lvl <= Level::warn) {
return osErr;
else
} else {
return osStd;
}
}
};
@ -121,8 +124,9 @@ private:
#endif
virtual std::ostream* getOs(Level lvl) {
if (lvl_min <= lvl && lvl <= lvl_max)
if (lvl_min <= lvl && lvl <= lvl_max) {
return &ofs;
}
return nullptr;
}
};
@ -185,8 +189,9 @@ std::ostream& defaultEntryMetaLevel(std::ostream& os, const Entry& e) {
void init() {
// add default console logger
if (outputs.empty())
if (outputs.empty()) {
outputs.push_back(std::unique_ptr<Output>(new ConsoleOutput()));
}
// set default entry metadata printing functions
auto space = [](std::ostream& os, const Entry& e) -> std::ostream& {