-
Notifications
You must be signed in to change notification settings - Fork 157
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
Syslog support #292
Syslog support #292
Conversation
Hi, thanks for the PR! But first I have to ask a stupid question: Why is this better than piping stdout and stderr to logger(1)? |
Hi. The main reason - support different syslog priorities. Sure, we can achieve this via piping earlyoom's stdout & stderr in different logger instances with different facilities\levels, but this trick is really ugly.
the things become more complicated, when u need start earlyoom via start-stop-daemon. so patching earlyoom code is just handy (by adding syslog param in default conf file) & portable solution. |
Ok, understood. I will accept syslog support. |
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.
Code looks clean but a little over-engineered :)
- I don't think
enum LOG_LEVEL
is needed. Just use the syslog levels directly. - I don't think
log_level_stream
,log_level_color
,log_level_syslog
are needed. Instead, addstream
,color
parameters to logger.
|
||
void earlyoom_syslog_init(void) | ||
{ | ||
if (!use_syslog) { |
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.
Do we need this if
?
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.
just double-init check, which is does not leads to any problems, but anyway.
main.c
Outdated
@@ -123,7 +123,7 @@ int main(int argc, char* argv[]) | |||
meminfo_t m = parse_meminfo(); | |||
|
|||
int c; | |||
const char* short_opt = "m:s:M:S:kingN:dvr:ph"; | |||
const char* short_opt = "m:s:M:S:kingN:Ldvr:ph"; |
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.
Please use --syslog
instead of -L
to be more explicit
Useful in embedded applications. Signed-off-by: Konstantin Menyaev <KAMenyaev@sberdevices.ru>
ef30af9
to
6f336f2
Compare
I merged this, thanks. Two more things if you have time:
|
syslog logging is useful in embedded applications, e.g in buildroot software