|
Revision 1203, 1.9 kB
(checked in by efphe, 1 year ago)
|
moving code from fenilot.org
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
|
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
#ifndef WLOG_H |
|---|
| 24 |
#define WLOG_H |
|---|
| 25 |
|
|---|
| 26 |
#include <syslog.h> |
|---|
| 27 |
#include <stdarg.h> |
|---|
| 28 |
#include <string.h> |
|---|
| 29 |
#include <stdio.h> |
|---|
| 30 |
#include <stdlib.h> |
|---|
| 31 |
#include <unistd.h> |
|---|
| 32 |
#include <sys/types.h> |
|---|
| 33 |
#include <signal.h> |
|---|
| 34 |
|
|---|
| 35 |
|
|---|
| 36 |
|
|---|
| 37 |
typedef enum { |
|---|
| 38 |
SYSLOG_FACILITY_DAEMON, |
|---|
| 39 |
SYSLOG_FACILITY_USER, |
|---|
| 40 |
SYSLOG_FACILITY_AUTH, |
|---|
| 41 |
#ifdef LOG_AUTHPRIV |
|---|
| 42 |
SYSLOG_FACILITY_AUTHPRIV, |
|---|
| 43 |
#endif |
|---|
| 44 |
SYSLOG_FACILITY_LOCAL0, |
|---|
| 45 |
SYSLOG_FACILITY_LOCAL1, |
|---|
| 46 |
SYSLOG_FACILITY_LOCAL2, |
|---|
| 47 |
SYSLOG_FACILITY_LOCAL3, |
|---|
| 48 |
SYSLOG_FACILITY_LOCAL4, |
|---|
| 49 |
SYSLOG_FACILITY_LOCAL5, |
|---|
| 50 |
SYSLOG_FACILITY_LOCAL6, |
|---|
| 51 |
SYSLOG_FACILITY_LOCAL7, |
|---|
| 52 |
SYSLOG_FACILITY_NOT_SET = -1 |
|---|
| 53 |
} SyslogFacility; |
|---|
| 54 |
|
|---|
| 55 |
typedef enum { |
|---|
| 56 |
SYSLOG_LEVEL_QUIET, |
|---|
| 57 |
SYSLOG_LEVEL_FATAL, |
|---|
| 58 |
SYSLOG_LEVEL_ERROR, |
|---|
| 59 |
SYSLOG_LEVEL_INFO, |
|---|
| 60 |
SYSLOG_LEVEL_VERBOSE, |
|---|
| 61 |
SYSLOG_LEVEL_DEBUG1, |
|---|
| 62 |
SYSLOG_LEVEL_DEBUG2, |
|---|
| 63 |
SYSLOG_LEVEL_DEBUG3, |
|---|
| 64 |
SYSLOG_LEVEL_NOT_SET = -1 |
|---|
| 65 |
} LogLevel; |
|---|
| 66 |
|
|---|
| 67 |
void log_init(char *, LogLevel, SyslogFacility, int); |
|---|
| 68 |
|
|---|
| 69 |
void fatal(const char *, ...); |
|---|
| 70 |
void error(const char *, ...); |
|---|
| 71 |
void logit(const char *, ...); |
|---|
| 72 |
void verbose(const char *, ...); |
|---|
| 73 |
void debug(const char *, ...); |
|---|
| 74 |
void debug2(const char *, ...); |
|---|
| 75 |
void debug3(const char *, ...); |
|---|
| 76 |
|
|---|
| 77 |
void do_log(LogLevel, const char *, va_list); |
|---|
| 78 |
#endif |
|---|