Dolda2000 GitWeb
/
ashd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
lib: Fixed bioprintf bug.
[ashd.git]
/
lib
/
log.c
diff --git
a/lib/log.c
b/lib/log.c
index
b87d4f6
..
bd07d8d
100644
(file)
--- a/
lib/log.c
+++ b/
lib/log.c
@@
-21,14
+21,28
@@
#include <stdio.h>
#include <syslog.h>
#include <stdio.h>
#include <syslog.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <utils.h>
#include <utils.h>
+#include <log.h>
+static int inited = 0;
static int tostderr = 1, tosyslog = 0;
static int tostderr = 1, tosyslog = 0;
+static void initlog(void)
+{
+ inited = 1;
+ if(getenv("ASHD_USESYSLOG") != NULL)
+ opensyslog();
+}
+
void flog(int level, char *format, ...)
{
va_list args;
void flog(int level, char *format, ...)
{
va_list args;
+ if(!inited)
+ initlog();
va_start(args, format);
if(tostderr) {
vfprintf(stderr, format, args);
va_start(args, format);
if(tostderr) {
vfprintf(stderr, format, args);
@@
-41,6
+55,8
@@
void flog(int level, char *format, ...)
void opensyslog(void)
{
void opensyslog(void)
{
+ if(!inited)
+ initlog();
openlog("ashd", 0, LOG_DAEMON);
tostderr = 0;
tosyslog = 1;
openlog("ashd", 0, LOG_DAEMON);
tostderr = 0;
tosyslog = 1;