1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

[PATCH] more logging.h cleanups to be a bit more flexible.

This commit is contained in:
greg@kroah.com 2004-02-12 18:57:06 -08:00 committed by Greg KH
parent d45ea2b70c
commit d026a35d74
5 changed files with 40 additions and 27 deletions

View File

@ -57,23 +57,11 @@
} while (0)
#endif
/* each program must declare this variable and function somewhere */
extern unsigned char logname[42];
extern int log_ok(void);
static void log_message (int level, const char *format, ...)
extern void log_message (int level, const char *format, ...)
__attribute__ ((format (printf, 2, 3)));
static inline void log_message (int level, const char *format, ...)
{
va_list args;
if (!log_ok())
return;
va_start(args, format);
vsyslog(level, format, args);
va_end(args);
}
/* each program that uses syslog must declare this variable somewhere */
extern unsigned char logname[42];
#undef init_logging
static inline void init_logging(char *program_name)

15
udev.c
View File

@ -38,12 +38,21 @@
/* global variables */
char **main_argv;
char **main_envp;
unsigned char logname[42];
int log_ok(void)
#ifdef LOG
unsigned char logname[42];
void log_message (int level, const char *format, ...)
{
return udev_log;
va_list args;
if (!udev_log)
return;
va_start(args, format);
vsyslog(level, format, args);
va_end(args);
}
#endif
static void sig_handler(int signum)
{

11
udevd.c
View File

@ -51,12 +51,17 @@ LIST_HEAD(running_list);
static void exec_queue_manager(void);
static void msg_queue_manager(void);
#ifdef LOG
unsigned char logname[42];
int log_ok(void)
void log_message (int level, const char *format, ...)
{
return 1;
va_list args;
va_start(args, format);
vsyslog(level, format, args);
va_end(args);
}
#endif
static void msg_dump_queue(void)
{

View File

@ -38,12 +38,18 @@
char **main_argv;
int main_argc;
unsigned char logname[42];
int log_ok(void)
#ifdef LOG
unsigned char logname[42];
void log_message (int level, const char *format, ...)
{
return 1;
va_list args;
va_start(args, format);
vsyslog(level, format, args);
va_end(args);
}
#endif
static int print_all_attributes(const char *path)
{

View File

@ -40,12 +40,17 @@
#include "udevd.h"
#include "logging.h"
#ifdef LOG
unsigned char logname[42];
int log_ok(void)
void log_message (int level, const char *format, ...)
{
return 1;
va_list args;
va_start(args, format);
vsyslog(level, format, args);
va_end(args);
}
#endif
static inline char *get_action(void)
{