Commit c848d5f6 authored by Dominik Charousset's avatar Dominik Charousset

Consistently use unsigned for log level & line nr

parent 573d8b06
...@@ -112,14 +112,17 @@ public: ...@@ -112,14 +112,17 @@ public:
event& operator=(const event&) = default; event& operator=(const event&) = default;
event(int lvl, string_view cat, string_view full_fun, string_view fun, event(unsigned lvl, unsigned line, string_view cat, string_view full_fun,
string_view fn, int line, std::string msg, std::thread::id t, string_view fun, string_view fn, std::string msg, std::thread::id t,
actor_id a, timestamp ts); actor_id a, timestamp ts);
// -- member variables ----------------------------------------------------- // -- member variables -----------------------------------------------------
/// Level/priority of the event. /// Level/priority of the event.
int level; unsigned level;
/// Current line in the file.
unsigned line_number;
/// Name of the category (component) logging the event. /// Name of the category (component) logging the event.
string_view category_name; string_view category_name;
...@@ -133,9 +136,6 @@ public: ...@@ -133,9 +136,6 @@ public:
/// Name of the current file. /// Name of the current file.
string_view file_name; string_view file_name;
/// Current line in the file.
int line_number;
/// User-provided message. /// User-provided message.
std::string message; std::string message;
...@@ -239,16 +239,16 @@ public: ...@@ -239,16 +239,16 @@ public:
return console_format_; return console_format_;
} }
int verbosity() const noexcept { unsigned verbosity() const noexcept {
return static_cast<int>(cfg_.verbosity); return cfg_.verbosity;
} }
int file_verbosity() const noexcept { unsigned file_verbosity() const noexcept {
return static_cast<int>(cfg_.file_verbosity); return cfg_.file_verbosity;
} }
int console_verbosity() const noexcept { unsigned console_verbosity() const noexcept {
return static_cast<int>(cfg_.console_verbosity); return cfg_.console_verbosity;
} }
// -- static utility functions ----------------------------------------------- // -- static utility functions -----------------------------------------------
...@@ -433,8 +433,8 @@ bool operator==(const logger::field& x, const logger::field& y); ...@@ -433,8 +433,8 @@ bool operator==(const logger::field& x, const logger::field& y);
#define CAF_LOG_MAKE_EVENT(aid, component, loglvl, message) \ #define CAF_LOG_MAKE_EVENT(aid, component, loglvl, message) \
::caf::logger::event { \ ::caf::logger::event { \
loglvl, component, CAF_PRETTY_FUN, __func__, \ loglvl, __LINE__, component, CAF_PRETTY_FUN, __func__, \
caf::logger::skip_path(__FILE__), __LINE__, \ caf::logger::skip_path(__FILE__), \
(::caf::logger::line_builder{} << message).get(), \ (::caf::logger::line_builder{} << message).get(), \
::std::this_thread::get_id(), aid, ::caf::make_timestamp() \ ::std::this_thread::get_id(), aid, ::caf::make_timestamp() \
} }
......
...@@ -254,15 +254,16 @@ logger::config::config() ...@@ -254,15 +254,16 @@ logger::config::config()
// nop // nop
} }
logger::event::event(int lvl, string_view cat, string_view full_fun, logger::event::event(unsigned lvl, unsigned line, string_view cat,
string_view fun, string_view fn, int line, std::string msg, string_view full_fun, string_view fun, string_view fn,
std::thread::id t, actor_id a, timestamp ts) std::string msg, std::thread::id t, actor_id a,
timestamp ts)
: level(lvl), : level(lvl),
line_number(line),
category_name(cat), category_name(cat),
pretty_fun(full_fun), pretty_fun(full_fun),
simple_fun(fun), simple_fun(fun),
file_name(fn), file_name(fn),
line_number(line),
message(std::move(msg)), message(std::move(msg)),
tid(std::move(t)), tid(std::move(t)),
aid(a), aid(a),
......
...@@ -179,11 +179,11 @@ CAF_TEST(rendering) { ...@@ -179,11 +179,11 @@ CAF_TEST(rendering) {
// Rendering of events. // Rendering of events.
logger::event e{ logger::event e{
CAF_LOG_LEVEL_WARNING, CAF_LOG_LEVEL_WARNING,
42,
"unit.test", "unit.test",
"void ns::foo::bar()", "void ns::foo::bar()",
"bar", "bar",
"foo.cpp", "foo.cpp",
42,
"hello world", "hello world",
std::this_thread::get_id(), std::this_thread::get_id(),
0, 0,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment