0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-19 00:10:59 +01:00

ircd::log: Connect the -debug command line switch to DEBUG facility.

This commit is contained in:
Jason Volk 2016-09-06 10:09:11 -07:00
parent 7ae8449078
commit 46d992d3a0

View file

@ -44,7 +44,8 @@ std::array<bool, num_of<facility>()> file_flush;
std::array<bool, num_of<facility>()> console_flush; std::array<bool, num_of<facility>()> console_flush;
std::array<const char *, num_of<facility>()> console_ansi; std::array<const char *, num_of<facility>()> console_ansi;
// Console device toggle // Runtime master switches
std::array<bool, num_of<facility>()> file_out;
std::array<bool, num_of<facility>()> console_out; std::array<bool, num_of<facility>()> console_out;
std::array<bool, num_of<facility>()> console_err; std::array<bool, num_of<facility>()> console_err;
@ -83,14 +84,14 @@ log::init()
console_err[WARNING] = true; console_err[WARNING] = true;
console_err[NOTICE] = true; console_err[NOTICE] = true;
console_out[INFO] = true; console_out[INFO] = true;
console_out[DEBUG] = true; console_out[DEBUG] = ircd::debugmode;
console_flush[CRITICAL] = true; file_out[CRITICAL] = true;
console_flush[ERROR] = true; file_out[ERROR] = true;
console_flush[WARNING] = true; file_out[WARNING] = true;
console_flush[NOTICE] = false; file_out[NOTICE] = true;
console_flush[INFO] = false; file_out[INFO] = true;
console_flush[DEBUG] = false; file_out[DEBUG] = ircd::debugmode;
file_flush[CRITICAL] = true; file_flush[CRITICAL] = true;
file_flush[ERROR] = true; file_flush[ERROR] = true;
@ -128,6 +129,9 @@ log::open()
if(!fname[fac]) if(!fname[fac])
return; return;
if(!file_out[fac])
return;
if(file[fac].is_open()) if(file[fac].is_open())
file[fac].close(); file[fac].close();
@ -142,6 +146,7 @@ log::close()
{ {
for_each<facility>([](const facility &fac) for_each<facility>([](const facility &fac)
{ {
if(file[fac].is_open())
file[fac].close(); file[fac].close();
}); });
} }