EVerest / liblog

A simple logging library
Apache License 2.0
5 stars 3 forks source link

Level always reported as [info] in logs #21

Open folkengine opened 5 months ago

folkengine commented 5 months ago

I noticed that even though I set the logs to different levels, they always are shown at the info levels. For instance:

EVLOG_verbose << "verbose boop!";
EVLOG_debug << "debug boop!";
EVLOG_info << "info boop!";
EVLOG_warning << "warning boop!";

prints out as

[2024-05-17 17:32:31.427336] [0x0000ffff81207cc0] [info]    verbose boop!
[2024-05-17 17:32:31.427351] [0x0000ffff81207cc0] [info]    debug boop!
[2024-05-17 17:32:31.427352] [0x0000ffff81207cc0] [info]    info boop!
[2024-05-17 17:32:31.427354] [0x0000ffff81207cc0] [info]    warning boop!
barsnick commented 5 months ago

Can you share some code and your logging.ini?

If I compile and run the example, I get

2024-05-27 16:48:49.502876 hello there     [0x00000f29] [DEBG] {0x00007f687446c740} void Everest::Logging::init(const string&, std::string) :: Logger initialized (using logging.ini)...
2024-05-27 16:48:49.503087 hello there     [0x00000f29] [DEBG] {0x00007f687446c740} int main(int, char**) :: logging_config was set to logging.ini
2024-05-27 16:48:49.503151 hello there     [0x00000f29] [DEBG] {0x00007f687446c740} int main(int, char**) :: This is a DEBUG message.
2024-05-27 16:48:49.503180 hello there     [0x00000f29] [INFO] {0x00007f687446c740}  :: This is a INFO message.
2024-05-27 16:48:49.503205 hello there     [0x00000f29] [WARN] {0x00007f687446c740} int main(int, char**) :: This is a WARNING message.
2024-05-27 16:48:49.503230 hello there     [0x00000f29] [ERRO] {0x00007f687446c740} int main(int, char**) :: This is a ERROR message.
2024-05-27 16:48:49.503254 hello there     [0x00000f29] [CRIT] {0x00007f687446c740} int main(int, char**) :: This is a CRITICAL message.
hikinggrass commented 3 months ago

This might happen if you do not call Everest::Logging::init() before you start to log using the EVLOG macros