-
-
Notifications
You must be signed in to change notification settings - Fork 673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use fmt for logging and allow to log to system daemon directly #606
Conversation
60ad8c1
to
28fcb0b
Compare
Apples |
756319d
to
3ca5201
Compare
Fixed the shell issue. You need to escape the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@nobounce
Nice work!
I like the idea, but would prefer the defaults to keep the code contained (with only simple logfile logging).
But having the option to easily enable syslog or journald options would be great.
Don't forget to add documentation in the compile sections of the README.md
@aristocratos |
bbdd822
to
d9faa05
Compare
cec4904
to
cf7bee7
Compare
@aristocratos |
e7964f8
to
59f2a05
Compare
b37e6b1
to
d2f7262
Compare
@aristocratos |
1eacc97
to
1bf7382
Compare
Avoids unnecessary recompilation
See: #535 The logger now takes a formatting string and a number of variable arguments according to the `fmt` spec
Moving the definition of the FMT_HEADER_ONLY macro from a file to the compiler makes all code relying on this macro independent of a single file Also cleanup some unused fmt includes
If the BTOP_LOG_LEVEL is found in the environment it is parsed and overwrites the current configured log level. The --debug switch still has precedence The value of BTOP_LOG_LEVEL must match one of `Logger::log_levels` fields, being case insensitive
This commit allows for btop to log to either syslog(3) or systemd's journal
Using std::call_once instead of boolean Define some log file specific variables only if syslog or journald are not used Rename the privilege RAII wrapper and delete all operators and constructors
This PR improves the logger in a few ways:
fmt
, See [REQUEST] Continued implementation of fmtlib #535fmt::format
fmt::print
instead ofstd::ofstream
FMT_HEADER_ONLY
is now defined by Make and passed to the compiler. Other files including<fmt/*.h>
are now independent of the definition inbtop_tools.hpp
<syslog.h>
is present, btop will log it's messages theremake ENABLE_JOURNALD=true
btop can directly log to journald. This can log interesting metadata like the source file location for each messageBTOP_LOG_LEVEL
environment variable and set the log level accordinglyOn systemd systems, with either
syslog
orjournald
logging, btops logs can be read withjournalctl -t btop
If this is not a good default, it's an easy fix to put this behind a
ENABLE_...
flag!I'm curious if this is a nice feature or not. Looking forward for feedback :)