Nilorea Library
C utilities for networking, threading, graphics
n_log.h File Reference

Generic log system. More...

#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <pthread.h>
#include "n_common.h"
#include <stdarg.h>
+ Include dependency graph for n_log.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  TS_LOG
 ThreadSafe LOGging structure. More...
 

Macros

#define LOG_ALERT   1
 action must be taken immediately More...
 
#define LOG_CRIT   2
 critical conditions More...
 
#define LOG_DEBUG   7
 debug-level messages More...
 
#define LOG_EMERG   0
 system is unusable More...
 
#define LOG_ERR   3
 error conditions More...
 
#define LOG_FILE   -3
 internal, logging to file More...
 
#define LOG_INFO   6
 informational More...
 
#define LOG_NOTICE   5
 normal but significant condition More...
 
#define LOG_NULL   -1
 no log output More...
 
#define LOG_STDERR   -4
 internal, default LOG_TYPE More...
 
#define LOG_SYSJRNL   100
 to sysjrnl More...
 
#define LOG_WARNING   4
 warning conditions More...
 
#define n_log(__LEVEL__, ...)
 Logging function wrapper to get line and func. More...
 

Functions

void _n_log (int level, const char *file, const char *func, int line, const char *format,...)
 Logging function. 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 write_safe_log (TS_LOG *log, char *pat,...)
 write to a thread-safe logging file More...
 

Detailed Description

Generic log system.

Author
Castagnier Mickael
Date
2013-04-15

Definition in file n_log.h.