Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

logging.h File Reference

#include <stdio.h>
#include <time.h>
#include "xetpan-types.h"

Include dependency graph for logging.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Defines

#define XETPAN_LOG_FILE   "xetpan.log"
#define XETPAN_LOG_FILE_BAK   "xetpan.log~"
#define SIZE_OF_TIME_STRING   9
#define A_LOGGING_ERROR()
#define A_LOGGING_SYSTEM_ERROR()
#define A_LOGGING_INFO()
#define A_LOGGING_DEBUG()
#define A_LOGGING_TRACE

Functions

int a_Logging_redirect (XetPan *xetpan, const char *path)

Variables

int verbose


Define Documentation

 
#define A_LOGGING_DEBUG  ) 
 

Value:

({if (verbose > 1)  \
fprintf(stderr, "%s:%d %s: ",__FILE__ , __LINE__ , __FUNCTION__), \
fprintf(stderr, __VA_ARGS__), \
fprintf(stderr, "\n");})
Debugging macro. Used when verbosity is > 1 .

 
#define A_LOGGING_ERROR  ) 
 

Value:

({char ts[SIZE_OF_TIME_STRING]; \
time_t t; \
t = time(NULL); \
strftime(ts, SIZE_OF_TIME_STRING, "%H:%M:%S", localtime(&t)); \
fprintf(stderr, "[%s] ERROR: ", ts); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n");})
Error logging macro.

 
#define A_LOGGING_INFO  ) 
 

Value:

({if (verbose) \
{ \
char ts[SIZE_OF_TIME_STRING]; \
time_t t; \
t = time(NULL); \
strftime(ts, SIZE_OF_TIME_STRING, "%H:%M:%S", localtime(&t)); \
fprintf(stderr, "[%s] ", ts); \
fprintf(stderr, __VA_ARGS__); \
fprintf(stderr, "\n");} \
} )

 
#define A_LOGGING_SYSTEM_ERROR  ) 
 

Value:

({fprintf(stderr, "%s (%s +%d) SYSTEM ERROR: ", __FUNCTION__, __FILE__, __LINE__), \
fprintf(stderr, __VA_ARGS__), \
fprintf(stderr, "\n");})

#define A_LOGGING_TRACE
 

Value:

({if (verbose > 1) \
fprintf(stderr,"%s:%d %s \n", __FILE__, __LINE__ , __FUNCTION__);})

#define SIZE_OF_TIME_STRING   9
 

#define XETPAN_LOG_FILE   "xetpan.log"
 

Log filename.

#define XETPAN_LOG_FILE_BAK   "xetpan.log~"
 

Log's backup filename


Function Documentation

int a_Logging_redirect XetPan xetpan,
const char *  path
 

Redirect standard error to a log file. This is done because many GUI application launchers do not show the user the standard error even if the application did not start. Makes a backup of the old log file if it existed.

Parameters:
path a directory where the log file will be created.
Returns:
0 on success, system's errno otherwise.

Here is the call graph for this function:


Variable Documentation

int verbose  ) 
 

Verbosity level. Currently: 0 to be quiet, 1 to be verbose, 2 to help debugging


Generated on Wed Oct 22 15:53:05 2003 for XetPan by doxygen 1.3.2