log.h File Reference

Implements logging function. More...

Go to the source code of this file.

Defines

#define MAX_LOG_SIZE   3000000
 max logfile size in bytes
#define MAX_LOG_STRING   1000
 len of the log string
Wrappers
After including log.h you have to define the current zone with the following statement:
define LOG_ZONE "CURRENT ZONE"


#define LOGIT(a, b, c, d, e...)   {logit(a,b,c,d,e);}
 Wrapper for logging.
#define LOG_INIT(logfile)   {log_init(logfile);}
 Wrapper for module init, logfile will be freed.
#define LOG_END()   {log_end();}
 Wrapper for module shutdown.
#define MALLOC_CHECK(p)
 overrides MALLOC_CHECK
#define ERROR_ABORT(a)
 overrides ERROR_ABORT
#define ERROR_PRINT(a...)
 overrides ERROR_PRINT
#define DBG(a...)
 DBG needs -v -v.
#define SAY(a...)
 SAY needs -v.

Functions

int logit (char *zone, char *preamble, char *filename, int line, char *str,...)
 log in a pretty way
int log_init (char *logfile)
 initialize the log module, logfile will be freed
int log_end (void)
 shut down the module
int log_get_verbosity (void)
 get verbosity level
void log_set_verbosity (int v)
 set verbosity level
int log_rotate (char *logfile)
char * log_get_logfile (void)


Detailed Description

Implements logging function.

Author:
Simone Vellei   <sorry guy>

Definition in file log.h.


Define Documentation

#define DBG ( a...   ) 

Value:

{\
        if (log_get_verbosity() >= 2) {\
                LOGIT(LOG_ZONE,"DBG",__FILE__,__LINE__,a);\
        }\
}
DBG needs -v -v.

Definition at line 58 of file log.h.

#define ERROR_ABORT (  ) 

Value:

{\
        LOGIT(LOG_ZONE,"ABORT",__FILE__,__LINE__,a);\
        abort();\
}
overrides ERROR_ABORT

Definition at line 49 of file log.h.

#define ERROR_PRINT ( a...   ) 

Value:

{\
        LOGIT(LOG_ZONE,"ERROR",__FILE__,__LINE__,a);\
}
overrides ERROR_PRINT

Definition at line 54 of file log.h.

 
#define LOG_END (  )     {log_end();}

Wrapper for module shutdown.

Definition at line 42 of file log.h.

#define LOG_INIT ( logfile   )     {log_init(logfile);}

Wrapper for module init, logfile will be freed.

Definition at line 40 of file log.h.

#define LOGIT ( a,
b,
c,
d,
e...   )     {logit(a,b,c,d,e);}

Wrapper for logging.

Definition at line 38 of file log.h.

#define MALLOC_CHECK (  ) 

Value:

{\
        if(p == NULL) \
                ERROR_ABORT("Unable to malloc\n");\
}
overrides MALLOC_CHECK

Definition at line 44 of file log.h.

#define MAX_LOG_SIZE   3000000

max logfile size in bytes

Definition at line 72 of file log.h.

#define MAX_LOG_STRING   1000

len of the log string

Definition at line 75 of file log.h.

#define SAY ( a...   ) 

Value:

{\
        if (log_get_verbosity() >= 1) {\
                LOGIT(LOG_ZONE,NULL,NULL,0,a);\
        }\
}
SAY needs -v.

Definition at line 64 of file log.h.


Function Documentation

int log_end ( void   ) 

shut down the module

char* log_get_logfile ( void   ) 

int log_get_verbosity ( void   ) 

get verbosity level

int log_init ( char *  logfile  ) 

initialize the log module, logfile will be freed

int log_rotate ( char *  logfile  ) 

void log_set_verbosity ( int  v  ) 

set verbosity level

int logit ( char *  zone,
char *  preamble,
char *  filename,
int  line,
char *  str,
  ... 
)

log in a pretty way

Parameters:
zone will be prepended
preamble string (if NULL the following 2 params are ignored)
file "__FILE__"
line "__LINE__"
str printf like syntax
Returns:
0 on success


Generated on Sat Nov 1 15:55:53 2008 for FreePOPs by  doxygen 1.5.6