| 1 |
sysadm |
1.1 |
/*
|
| 2 |
|
|
* Copyright (C) 1998 Mark Baysinger (mbaysing@ucsd.edu)
|
| 3 |
|
|
* Copyright (C) 1998,1999,2000 Ross Combs (rocombs@cs.nmsu.edu)
|
| 4 |
|
|
*
|
| 5 |
|
|
* This program is free software; you can redistribute it and/or
|
| 6 |
|
|
* modify it under the terms of the GNU General Public License
|
| 7 |
|
|
* as published by the Free Software Foundation; either version 2
|
| 8 |
|
|
* of the License, or (at your option) any later version.
|
| 9 |
|
|
*
|
| 10 |
|
|
* This program is distributed in the hope that it will be useful,
|
| 11 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
| 12 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
| 13 |
|
|
* GNU General Public License for more details.
|
| 14 |
|
|
*
|
| 15 |
|
|
* You should have received a copy of the GNU General Public License
|
| 16 |
|
|
* along with this program; if not, write to the Free Software
|
| 17 |
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
| 18 |
|
|
*/
|
| 19 |
|
|
#ifndef INCLUDED_EVENTLOG_TYPES
|
| 20 |
|
|
#define INCLUDED_EVENTLOG_TYPES
|
| 21 |
|
|
|
| 22 |
|
|
typedef enum
|
| 23 |
|
|
{
|
| 24 |
|
|
eventlog_level_none = 0,
|
| 25 |
|
|
eventlog_level_trace= 1,
|
| 26 |
|
|
eventlog_level_debug= 2,
|
| 27 |
|
|
eventlog_level_info = 4,
|
| 28 |
|
|
eventlog_level_warn = 8,
|
| 29 |
|
|
eventlog_level_error=16,
|
| 30 |
|
|
eventlog_level_fatal=32
|
| 31 |
|
|
} t_eventlog_level;
|
| 32 |
|
|
|
| 33 |
|
|
#endif
|
| 34 |
|
|
|
| 35 |
|
|
|
| 36 |
|
|
/*****/
|
| 37 |
|
|
#ifndef JUST_NEED_TYPES
|
| 38 |
|
|
#ifndef INCLUDED_EVENTLOG_PROTOS
|
| 39 |
|
|
#define INCLUDED_EVENTLOG_PROTOS
|
| 40 |
|
|
|
| 41 |
|
|
#define JUST_NEED_TYPES
|
| 42 |
|
|
#include <stdio.h>
|
| 43 |
|
|
#undef JUST_NEED_TYPES
|
| 44 |
|
|
|
| 45 |
|
|
extern void eventlog_set_debugmode(int debugmode);
|
| 46 |
|
|
extern void eventlog_set(FILE * fp);
|
| 47 |
|
|
extern FILE * eventlog_get(void);
|
| 48 |
|
|
extern int eventlog_open(char const * filename);
|
| 49 |
|
|
extern int eventlog_close(void);
|
| 50 |
|
|
extern void eventlog_clear_level(void);
|
| 51 |
|
|
extern int eventlog_add_level(char const * levelname);
|
| 52 |
|
|
extern int eventlog_del_level(char const * levelname);
|
| 53 |
|
|
extern char const * eventlog_get_levelname_str(t_eventlog_level level);
|
| 54 |
|
|
#ifdef DEBUGMODSTRINGS
|
| 55 |
|
|
|
| 56 |
|
|
extern void eventlog_real(t_eventlog_level level, char const * module, char const * fmt, ...) PRINTF_ATTR(3,4);
|
| 57 |
|
|
# if __STDC_VERSION__+1 >= 199901L
|
| 58 |
|
|
# define eventlog(l,m,f,args...) eventlog_real(l,"@(" __FILE__ ":" m "@@" __func__ ")@",f,##args)
|
| 59 |
|
|
# else
|
| 60 |
|
|
# if defined(__GNUC__) && ((__GNUC__ == 2 && __GNUC_MINOR__ >= 7) || __GNUC__ > 2)
|
| 61 |
|
|
# define eventlog(l,m,f,args...) eventlog_real(l,"@(" __FILE__ ":" m "@@" __PRETTY_FUNCTION__ ")@",f,##args)
|
| 62 |
|
|
# else
|
| 63 |
|
|
# error "No function macro available, either don't define DEBUGMODSTRINGS or don't use -pedantic"
|
| 64 |
|
|
# endif
|
| 65 |
|
|
# endif
|
| 66 |
|
|
|
| 67 |
|
|
#else
|
| 68 |
|
|
|
| 69 |
|
|
extern void eventlog_hexdump_data(void const * data, unsigned int len);
|
| 70 |
|
|
extern void eventlog(t_eventlog_level level, char const * module, char const * fmt, ...);
|
| 71 |
|
|
extern void eventlog_step(char const * filename, t_eventlog_level level, char const * module, char const * fmt, ...);
|
| 72 |
|
|
|
| 73 |
|
|
#endif
|
| 74 |
|
|
|
| 75 |
|
|
#endif
|
| 76 |
|
|
#endif
|