[RFC] make bb_[p]error_msgXXXX() functions able to direct output to syslog
Denis Vlasenko
vda.linux at googlemail.com
Sun Sep 3 12:39:55 UTC 2006
Hi,
I worked on zcip (http://bugs.busybox.net/view.php?id=1005)
and in the process I fixed inconsistent use of syslog and bb_[p]error
functions.
But it looks ugly:
+ if (FOREGROUND)
+ bb_perror_msg("%s %s, %s",
+ arg, intf, why);
+ else
+ syslog(LOG_ERR, "%s %s, %s: %s",
+ arg, intf, why, strerror(errno));
Worse. If you have a xfunc(), it will not direct its output
to syslog, and I should use ordinary func() instead.
I do not want to do it. It defeats the purpose of xfunc().
The solution which seems ok to me is to make bb_[p]error
syslog aware. That is, we need a global flag variable which
says "direct all bb_[p]error output to syslog (because
we are daemonized and there is no usable stdout/err)"
Minor problem is how to select syslog level, but it isn't
that serious.
Any objections?
--
vda
More information about the busybox
mailing list