#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <fcntl.h>
#include <syslog.h>
#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <butils/errorp.h>
#include <butils/logg.h>
Go to the source code of this file.
Functions |
void | error_dump_string (const char *msg, char *buff, size_t buff_size) |
static void | tls_free (void *val) |
int | MLOG_init (MLOG_LEVEL current, MLOG_ACTION action, void *arg) |
| explicitly initialises logging.
|
int | MLOG_alloc_option (MLOG_ALLOC option, size_t size) |
| determines memory allocation stragegy used here
|
void | MLOG_dump_stack_level (MLOG_LEVEL level) |
| set log level for which the current stack is dumped. By default this would happen for LOG_LEVEL_ERROR
|
int | MLOG_printf (MLOG_LEVEL current, const char *file, int line, const char *format,...) |
| create a log entry, do not use this function directly, use MLOG_<LOG_LEVEL_NAME> macros instead
|
Variables |
MLOG_LEVEL | m_current_log_level = MLOG_LEVEL_ERROR |
static MLOG_ACTION | log_action |
static MLOG_ALLOC | alloc_strategy = MLOG_ALLOC_TLS_HEAP |
static MLOG_LEVEL | stack_dump_level = MLOG_LEVEL_ERROR |
static size_t | alloc_size = 1024 |
static pthread_key_t | log_tls_entry |
static int | log_fd |
static int | log_prefix_level = MLOG_PREFIX_LOG_LEVEL | MLOG_PREFIX_SOURCE_FILE | MLOG_PREFIX_TIME |
static char * | log_level_names [] |
Function Documentation
void error_dump_string |
( |
const char * |
msg, |
|
|
char * |
buff, |
|
|
size_t |
buff_size |
|
) |
| |
Definition at line 98 of file errorp.c.
{
#if __linux__
void *sframes[ STACK_FRAMES + 1 ];
int nframes, i;
#endif
write( FD_OUT , msg , strlen( msg ) );
#if __linux__
nframes = backtrace( sframes, STACK_FRAMES + 1); \
write( FD_OUT, STACK_START, strlen( STACK_START ) );
nframes = backtrace( sframes, STACK_FRAMES );
for (i=0; i<nframes; i++) {
snprintf( buff, buff_size, "frame %d ip: %p\n", i, sframes[ i ]);
write( FD_OUT , buff, strlen( buff ) );
}
dump_modules( buff, buff_size );
write( FD_OUT, STACK_EOF, strlen( STACK_EOF ) );
#endif
}
static void tls_free |
( |
void * |
val | ) |
[static] |
Definition at line 36 of file logg.c.
{
if (val) {
free(val);
}
}
Variable Documentation
Initial value: {
"TURN_OFF_LOGGING",
"ERROR",
"WARN",
"INFO",
"DEBUG",
"TRACE",
}
Definition at line 24 of file logg.c.
int log_prefix_level = MLOG_PREFIX_LOG_LEVEL | MLOG_PREFIX_SOURCE_FILE | MLOG_PREFIX_TIME [static] |