mirror of
https://github.com/matrix-construct/construct
synced 2024-10-01 05:08:59 +02:00
ircd::log: Make the level enumeration strictly unsigned.
modules/console: Fix sign v. unsign comparison.
This commit is contained in:
parent
0704625401
commit
58b286e651
2 changed files with 7 additions and 6 deletions
|
@ -19,7 +19,7 @@
|
||||||
/// Logging system
|
/// Logging system
|
||||||
namespace ircd::log
|
namespace ircd::log
|
||||||
{
|
{
|
||||||
enum level :int;
|
enum level :uint;
|
||||||
struct log;
|
struct log;
|
||||||
struct vlog;
|
struct vlog;
|
||||||
struct logf;
|
struct logf;
|
||||||
|
@ -65,8 +65,9 @@ namespace ircd::log
|
||||||
extern log general; // "ircd", 'G'
|
extern log general; // "ircd", 'G'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Severity level; zero is the most severe. Severity decreases as level increases.
|
||||||
enum ircd::log::level
|
enum ircd::log::level
|
||||||
:int
|
:uint
|
||||||
{
|
{
|
||||||
CRITICAL = 0, ///< Catastrophic/unrecoverable; program is in a compromised state.
|
CRITICAL = 0, ///< Catastrophic/unrecoverable; program is in a compromised state.
|
||||||
ERROR = 1, ///< Things that shouldn't happen; user impacted and should know.
|
ERROR = 1, ///< Things that shouldn't happen; user impacted and should know.
|
||||||
|
|
|
@ -561,7 +561,7 @@ console_cmd__log__level(opt &out, const string_view &line)
|
||||||
|
|
||||||
if(!param.count())
|
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)
|
if(i > RB_LOG_LEVEL)
|
||||||
out << "[\033[1;40m-\033[0m] " << reflect(log::level(i)) << std::endl;
|
out << "[\033[1;40m-\033[0m] " << reflect(log::level(i)) << std::endl;
|
||||||
else if(console_enabled(log::level(i)))
|
else if(console_enabled(log::level(i)))
|
||||||
|
@ -572,12 +572,12 @@ console_cmd__log__level(opt &out, const string_view &line)
|
||||||
return true;
|
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)
|
if(i > RB_LOG_LEVEL)
|
||||||
{
|
{
|
||||||
out << "[\033[1;40m-\033[0m] " << reflect(log::level(i)) << std::endl;
|
out << "[\033[1;40m-\033[0m] " << reflect(log::level(i)) << std::endl;
|
||||||
|
|
Loading…
Reference in a new issue