0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-25 21:38:18 +02:00

ircd::log: Make the level enumeration strictly unsigned.

modules/console: Fix sign v. unsign comparison.
This commit is contained in:
Jason Volk 2019-07-19 17:25:24 -07:00
parent 0704625401
commit 58b286e651
2 changed files with 7 additions and 6 deletions

View file

@ -19,7 +19,7 @@
/// Logging system
namespace ircd::log
{
enum level :int;
enum level :uint;
struct log;
struct vlog;
struct logf;
@ -65,8 +65,9 @@ namespace ircd::log
extern log general; // "ircd", 'G'
}
/// Severity level; zero is the most severe. Severity decreases as level increases.
enum ircd::log::level
:int
:uint
{
CRITICAL = 0, ///< Catastrophic/unrecoverable; program is in a compromised state.
ERROR = 1, ///< Things that shouldn't happen; user impacted and should know.

View file

@ -561,7 +561,7 @@ console_cmd__log__level(opt &out, const string_view &line)
if(!param.count())
{
for(int i(0); i < num_of<log::level>(); ++i)
for(auto i(0U); i < num_of<log::level>(); ++i)
if(i > RB_LOG_LEVEL)
out << "[\033[1;40m-\033[0m] " << reflect(log::level(i)) << std::endl;
else if(console_enabled(log::level(i)))
@ -572,12 +572,12 @@ console_cmd__log__level(opt &out, const string_view &line)
return true;
}
const int level
const auto level
{
param.at<int>(0)
param.at<uint>(0)
};
for(int i(0); i < num_of<log::level>(); ++i)
for(auto i(0U); i < num_of<log::level>(); ++i)
if(i > RB_LOG_LEVEL)
{
out << "[\033[1;40m-\033[0m] " << reflect(log::level(i)) << std::endl;