1 /* 2 * (c) Copyright 1992, 1993 by Panagiotis Tsirigotis 3 * All rights reserved. The file named COPYRIGHT specifies the terms 4 * and conditions for redistribution. 5 */ 6 7 #ifndef __XLOG_H 8 #define __XLOG_H 9 10 /* 11 * $Id: xlog.h,v 1.2 2003-03-09 19:30:08 steveg Exp $ 12 */ 13 14 /* 15 * Flags 16 */ 17 #define XLOG_NOFLAGS 0x0 18 #define XLOG_SET_LEVEL 0x1 19 #define XLOG_NO_SIZECHECK 0x2 20 #define XLOG_NO_ERRNO 0x4 21 /* #define XLOG_PRINT_TIMESTAMP 0x8 */ 22 #define XLOG_PRINT_ID 0x10 23 #define XLOG_PRINT_PID 0x20 24 25 /* 26 * Errors 27 */ 28 #define XLOG_ENOERROR 0 29 #define XLOG_ESIZE 1 30 #define XLOG_EOPEN 2 31 #define XLOG_EFSTAT 3 32 #define XLOG_ENOMEM 4 33 #define XLOG_EWRITE 5 34 35 /* 36 * Interface 37 */ 38 39 typedef enum { XLOG_SYSLOG, XLOG_FILELOG } xlog_e ; 40 41 typedef enum 42 { 43 XLOG_LINK, /* generic: link this log to another log */ 44 XLOG_CALLBACK, /* generic: call this function in case of error */ 45 XLOG_GETFLAG, /* generic: get value of specified flag */ 46 XLOG_SETFLAG, /* generic: set value of specified flag */ 47 XLOG_LEVEL, /* syslog: set the default syslog level */ 48 XLOG_FACILITY, /* syslog: set the default syslog facility */ 49 XLOG_PREEXEC, /* syslog: prepare the log for an exec(2) */ 50 XLOG_POSTEXEC, /* syslog: exec(2) failed */ 51 XLOG_SIZECHECK, /* filelog: check file size */ 52 XLOG_GETFD, /* filelog: get file descriptor of log file */ 53 XLOG_LIMITS /* filelog: set (new) soft/hard limits */ 54 } xlog_cmd_e ; 55 56 typedef void *xlog_h ; 57 58 xlog_h xlog_create ( xlog_e type, const char *id, int flags, ... ) ; 59 void xlog_destroy ( xlog_h ) ; 60 void xlog_write ( xlog_h, const char *buf, int len, int flags, ... ) ; 61 int xlog_control ( xlog_h, xlog_cmd_e, ... ) ; 62 int xlog_parms ( xlog_e type, ... ) ; 63 64 #endif /* __XLOG_H */ 65