Nilorea Library
C utilities for networking, threading, graphics
|
generic logging system More...
#include "nilorea/n_common.h"
#include "nilorea/n_log.h"
#include <pthread.h>
#include <string.h>
#include <inttypes.h>
#include <syslog.h>
Go to the source code of this file.
Data Structures | |
struct | LOG_LEVELS |
internal struct to handle log types More... | |
Functions | |
void | _n_log (int level, const char *file, const char *func, int line, const char *format,...) |
Logging function. More... | |
int | _vscprintf_so (const char *format, va_list pargs) |
compute the size of a string made with format 'fmt' and arguments in the va_list 'ap', helper for vasprintf More... | |
int | asprintf (char *strp[], const char *fmt,...) |
snprintf from a va_list More... | |
int | close_safe_logging (TS_LOG *log) |
close a thread-safe logging file More... | |
void | close_sysjrnl (void) |
Close syslog connection or clean internals for event log. More... | |
FILE * | get_log_file (void) |
return the current log_file More... | |
int | get_log_level (void) |
Get the global log level value. More... | |
int | open_safe_logging (TS_LOG **log, char *pathname, char *opt) |
Open a thread-safe logging file. More... | |
char * | open_sysjrnl (char *identity) |
Open connection to syslog or create internals for event log. More... | |
int | set_log_file (char *file) |
Set the logging to a file instead of stderr. More... | |
void | set_log_level (const int log_level) |
Set the global log level value ( static int LOG_LEVEL ) More... | |
int | vasprintf (char **strp, const char *fmt, va_list ap) |
snprintf from a va_list, helper for asprintf More... | |
int | write_safe_log (TS_LOG *log, char *pat,...) |
write to a thread-safe logging file More... | |
Variables | |
static FILE * | log_file = NULL |
static FILE handling if logging to file is enabled More... | |
static int | LOG_LEVEL = LOG_NULL |
static global maximum wanted log level value More... | |
static int | LOG_TYPE = LOG_STDERR |
static global logging type ( STDERR, FILE, SYSJRNL ) More... | |
static LOG_LEVELS | prioritynames [] |
array of log levels More... | |
char * | proc_name = NULL |
static proc name, for windows event log More... | |
struct LOG_LEVELS |
int _vscprintf_so | ( | const char * | format, |
va_list | pargs | ||
) |
compute the size of a string made with format 'fmt' and arguments in the va_list 'ap', helper for vasprintf
format | format to pass to printf |
pargs | va_list to use as printf parameter |
Definition at line 172 of file n_log.c.
Referenced by vasprintf().
int asprintf | ( | char * | strp[], |
const char * | fmt, | ||
... | |||
) |
snprintf from a va_list
strp | string holding the result |
fmt | format to pass to printf |
... | list of format parameters |
Definition at line 216 of file n_log.c.
References vasprintf().
int vasprintf | ( | char ** | strp, |
const char * | fmt, | ||
va_list | ap | ||
) |
snprintf from a va_list, helper for asprintf
strp | string holding the result |
fmt | format to pass to printf |
ap | va_list to use as printf parameter |
Definition at line 191 of file n_log.c.
References _vscprintf_so(), and Malloc.
Referenced by _n_log(), _n_nodup_log(), _n_nodup_log_indexed(), and asprintf().
|
static |
static FILE handling if logging to file is enabled
Definition at line 53 of file n_log.c.
Referenced by _n_log(), get_log_file(), and set_log_file().
|
static |
static global maximum wanted log level value
Definition at line 47 of file n_log.c.
Referenced by get_log_level(), and set_log_level().
|
static |
static global logging type ( STDERR, FILE, SYSJRNL )
Definition at line 50 of file n_log.c.
Referenced by _n_log(), and set_log_level().
|
static |
char* proc_name = NULL |
static proc name, for windows event log
Definition at line 56 of file n_log.c.
Referenced by _n_log(), close_sysjrnl(), and open_sysjrnl().