2008-08-22 17:58:49 +02:00
|
|
|
/*
|
|
|
|
error.c --
|
|
|
|
Error logging
|
|
|
|
*/
|
2008-08-07 14:43:17 +02:00
|
|
|
|
2008-08-21 22:34:00 +02:00
|
|
|
#include "osd.h"
|
2008-08-07 14:43:17 +02:00
|
|
|
|
|
|
|
FILE *error_log;
|
|
|
|
|
|
|
|
struct {
|
|
|
|
int enabled;
|
|
|
|
int verbose;
|
|
|
|
FILE *log;
|
|
|
|
} t_error;
|
|
|
|
|
|
|
|
void error_init(void)
|
|
|
|
{
|
2008-08-21 22:34:00 +02:00
|
|
|
error_log = fopen("error.log","w");
|
2008-08-07 14:43:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void error_shutdown(void)
|
|
|
|
{
|
2008-08-21 22:34:00 +02:00
|
|
|
if(error_log) fclose(error_log);
|
2008-08-07 14:43:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void error(char *format, ...)
|
|
|
|
{
|
2008-08-21 22:34:00 +02:00
|
|
|
if (!log_error) return;
|
|
|
|
va_list ap;
|
|
|
|
va_start(ap, format);
|
|
|
|
if(error_log) vfprintf(error_log, format, ap);
|
|
|
|
va_end(ap);
|
2008-08-07 14:43:17 +02:00
|
|
|
}
|
|
|
|
|