mirror of
https://github.com/matrix-construct/construct
synced 2025-03-14 05:20:17 +01: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
|
||||
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.
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue