#include <stdlib.h>#include <stdio.h>#include <string.h>#include <stdarg.h>#include "log.h"
Go to the source code of this file.
Functions | |
| int | gs_log_init (const char *ident, int option, int facility, const char *default_event) |
| int | gs_log_write (const char *file, const int line, const char *function, int level, const char *event, const char *format,...) |
| int | gs_log_finalize () |
Variables | |
| static char * | _GS_DEFAULT_LOG_EVENT = NULL |
| static char * | _GS_DEFAULT_LOG_IDENT = NULL |
This file contains logging functions for GridSolve.
Definition in file log_default.c.
| int gs_log_finalize | ( | ) |
Releases any resources allocated by the logging system.
Definition at line 86 of file log_default.c.
{
if(_GS_DEFAULT_LOG_EVENT)
free(_GS_DEFAULT_LOG_EVENT);
_GS_DEFAULT_LOG_EVENT = NULL;
if(_GS_DEFAULT_LOG_IDENT)
free(_GS_DEFAULT_LOG_IDENT);
_GS_DEFAULT_LOG_IDENT = NULL;
return 0;
}

| int gs_log_init | ( | const char * | ident, | |
| int | option, | |||
| int | facility, | |||
| const char * | default_event | |||
| ) |
Initializes the logging system.
| ident | -- | |
| option | -- | |
| facility | -- | |
| default_event | -- |
Definition at line 36 of file log_default.c.
{
fprintf(stderr,"Initializing logging %s %s \n", ident, default_event);
_GS_DEFAULT_LOG_EVENT = strdup(default_event);
_GS_DEFAULT_LOG_IDENT = strdup(ident);
fprintf(stderr,"Set logging %s %s \n", _GS_DEFAULT_LOG_IDENT, _GS_DEFAULT_LOG_EVENT);
atexit((void (*)())gs_log_finalize);
return 0;
}


| int gs_log_write | ( | const char * | file, | |
| const int | line, | |||
| const char * | function, | |||
| int | level, | |||
| const char * | event, | |||
| const char * | format, | |||
| ... | ||||
| ) |
Writes a message to the log.
| file | -- | |
| line | -- | |
| function | -- | |
| level | -- | |
| event | -- | |
| format | -- | |
| ... | -- |
Definition at line 62 of file log_default.c.
{
va_list argptr;
if (event == NULL) {
fprintf(stderr, "Received NULL event, default %s\n", _GS_DEFAULT_LOG_EVENT);
event = _GS_DEFAULT_LOG_EVENT;
}
fprintf(stderr,"%s:%d [%s] %d %s", file,line,function,level,event);
va_start(argptr, format);
vfprintf(stderr,format, argptr);
fflush(stderr);
return 0;
}

char* _GS_DEFAULT_LOG_EVENT = NULL [static] |
Definition at line 17 of file log_default.c.
char* _GS_DEFAULT_LOG_IDENT = NULL [static] |
Definition at line 18 of file log_default.c.
1.6.3-20100507