2 #ifndef _ATALK_LOGGER_H
3 #define _ATALK_LOGGER_H 1
5 #include <atalk/boolean.h>
11 #define MAXLOGSIZE 512
26 #define LOGLEVEL_STRING_IDENTIFIERS { \
39 /* this is the enum specifying all availiable logtypes */
47 logtype_end_of_list_marker /* don't put any logtypes after this */
50 /* these are the string identifiers corresponding to each logtype */
51 #define LOGTYPE_STRING_IDENTIFIERS { \
58 "end_of_list_marker"} \
60 /* Display Option flags. */
61 /* redefine these so they can don't interfeer with syslog */
62 /* these can be used in standard logging too */
63 #define logoption_pid 0x01 /* log the pid with each message */
64 #define logoption_cons 0x02 /* log on the console if error logging */
65 #define logoption_ndelay 0x08 /* don't delay open */
66 #define logoption_perror 0x20 /* log to stderr as well */
67 #define logoption_nfile 0x40 /* ignore the file that called the log */
68 #define logoption_nline 0x80 /* ignore the line that called the log*/
71 /* redefine these so they can don't interfeer with syslog */
72 #define logfacility_user (1<<3) /* random user-level messages */
73 #define logfacility_mail (2<<3) /* mail system */
74 #define logfacility_daemon (3<<3) /* system daemons */
75 #define logfacility_auth (4<<3) /* security/authorization messages */
76 #define logfacility_syslog (5<<3) /* messages generated by syslogd */
77 #define logfacility_lpr (6<<3) /* line printer subsystem */
78 #define logfacility_authpriv (10<<3) /* security/auth messages (private) */
79 #define logfacility_ftp (11<<3) /* ftp daemon */
81 /* Setup the log filename and the loglevel, and the type of log it is. */
82 /* setup the internal variables used by the logger (called automatically) */
85 bool log_setup(char *filename, enum loglevels loglevel, enum logtypes logtype,
88 /* Setup the Level and type of log that will be logged to syslog. */
89 void syslog_setup(enum loglevels loglevel, enum logtypes logtype,
90 int display_options, int facility);
92 /* void setuplog(char *logsource, char *logtype, char *loglevel, char *filename); */
93 void setuplog(char *logtype, char *loglevel, char *filename);
95 /* finish up and close the logs */
98 /* This function sets up the ProcessName */
99 void set_processname(char *processname);
102 void make_log_entry(enum loglevels loglevel, enum logtypes logtype,
105 #ifndef DISABLE_LOGGER
106 typedef void(*make_log_func)
107 (enum loglevels loglevel, enum logtypes logtype, char *message, ...);
108 make_log_func set_log_location(char *srcfilename, int srclinenumber);
110 void LoadProccessNameFromProc();
112 #define LOG set_log_location(__FILE__, __LINE__)
113 #else /* DISABLE_LOGGER */
114 /* if the logger is disabled the rest is a bit futile */
115 #define LOG make_log_entry
116 #endif /* DISABLE_LOGGER */