![]() |
Nilorea Library
C utilities for networking, threading, graphics
|
Data Structures | |
| struct | TS_LOG |
| ThreadSafe LOGging structure. More... | |
Macros | |
| #define | LOG_ALERT 1 |
| action must be taken immediately | |
| #define | LOG_CRIT 2 |
| critical conditions | |
| #define | LOG_DEBUG 7 |
| debug-level messages | |
| #define | LOG_EMERG 0 |
| system is unusable | |
| #define | LOG_ERR 3 |
| error conditions | |
| #define | LOG_FILE -3 |
| internal, logging to file | |
| #define | LOG_INFO 6 |
| informational | |
| #define | LOG_NOTICE 5 |
| normal but significant condition | |
| #define | LOG_NULL -1 |
| no log output | |
| #define | LOG_STDERR -4 |
| internal, default LOG_TYPE | |
| #define | LOG_SYSJRNL 100 |
| to sysjrnl | |
| #define | LOG_WARNING 4 |
| warning conditions | |
| #define | n_log(__LEVEL__, ...) |
| Logging function wrapper to get line and func. | |
Functions | |
| void | _n_log (int level, const char *file, const char *func, int line, const char *format,...) |
| Logging function. | |
| int | close_safe_logging (TS_LOG *log) |
| close a thread-safe logging file | |
| void | close_sysjrnl (void) |
| Close syslog connection or clean internals for event log. | |
| FILE * | get_log_file (void) |
| return the current log_file | |
| int | get_log_level (void) |
| Get the global log level value. | |
| int | open_safe_logging (TS_LOG **log, char *pathname, char *opt) |
| Open a thread-safe logging file. | |
| char * | open_sysjrnl (char *identity) |
| Open connection to syslog or create internals for event log. | |
| int | set_log_file (char *file) |
| Set the logging to a file instead of stderr. | |
| void | set_log_level (const int log_level) |
| Set the global log level value ( static int LOG_LEVEL ) | |
| int | write_safe_log (TS_LOG *log, char *pat,...) |
| write to a thread-safe logging file | |
| struct TS_LOG |
| #define LOG_ALERT 1 |
| #define LOG_DEBUG 7 |
debug-level messages
| #define LOG_ERR 3 |
error conditions
| #define LOG_INFO 6 |
informational
| #define LOG_NOTICE 5 |
normal but significant condition
| #define LOG_NULL -1 |
no log output
| #define LOG_STDERR -4 |
internal, default LOG_TYPE
| #define n_log | ( | __LEVEL__, | |
| ... | |||
| ) |
Logging function wrapper to get line and func.
| void _n_log | ( | int | level, |
| const char * | file, | ||
| const char * | func, | ||
| int | line, | ||
| const char * | format, | ||
| ... | |||
| ) |
Logging function.
log( level , const char *format , ... ) is a macro around _log
| level | Logging level |
| file | File containing the emmited log |
| func | Function emmiting the log |
| line | Line of the log |
| format | Format and string of the log, printf style |
Definition at line 244 of file n_log.c.
References COLOR_BLUE, COLOR_CYAN, COLOR_GREEN, COLOR_MAGENTA, COLOR_RED, COLOR_RESET, COLOR_WHITE, COLOR_YELLOW, FreeNoLog, get_log_level(), LOG_ALERT, LOG_CRIT, LOG_DEBUG, LOG_EMERG, LOG_ERR, log_file, LOG_INFO, log_level, LOG_NOTICE, LOG_NULL, LOG_SYSJRNL, LOG_TYPE, LOG_WARNING, Malloc, prioritynames, proc_name, terminal_support_colors, and vasprintf().
Referenced by _n_nodup_log(), and _n_nodup_log_indexed().
Here is the call graph for this function:
Here is the caller graph for this function:| int close_safe_logging | ( | TS_LOG * | log | ) |
close a thread-safe logging file
| log | A TS_LOG handler |
Definition at line 432 of file n_log.c.
References TS_LOG::file, and TS_LOG::LOG_MUTEX.
Referenced by main().
Here is the caller graph for this function:| void close_sysjrnl | ( | void | ) |
| FILE * get_log_file | ( | void | ) |
| int get_log_level | ( | void | ) |
| int open_safe_logging | ( | TS_LOG ** | log, |
| char * | pathname, | ||
| char * | opt | ||
| ) |
Open a thread-safe logging file.
| log | A TS_LOG handler |
| pathname | The file path (if any) and name |
| opt | Options for opening (please never forget to use "w") |
Definition at line 338 of file n_log.c.
References _str, TS_LOG::file, LOG_ERR, Malloc, and n_log.
Referenced by main().
Here is the caller graph for this function:| char * open_sysjrnl | ( | char * | identity | ) |
Open connection to syslog or create internals for event log.
| identity | Tag for syslog or NULL to use argv[0] |
Definition at line 77 of file n_log.c.
References __n_assert, and proc_name.
| int set_log_file | ( | char * | file | ) |
Set the logging to a file instead of stderr.
| file | The filename where to log |
Definition at line 151 of file n_log.c.
References __n_assert, _str, LOG_ERR, LOG_FILE, log_file, n_log, and set_log_level().
Referenced by main(), and main().
Here is the call graph for this function:
Here is the caller graph for this function:| void set_log_level | ( | const int | log_level | ) |
Set the global log level value ( static int LOG_LEVEL )
| log_level | Log level value. Supported: NOLOG,LOG_NOTICE/INFO/ERR/DEBUG,LOG_FILE/STDERR/SYSJRNL |
Definition at line 104 of file n_log.c.
References LOG_FILE, log_level, LOG_LEVEL, LOG_STDERR, LOG_SYSJRNL, LOG_TYPE, and terminal_support_colors.
Referenced by main(), main(), main(), process_args(), process_args(), process_args(), and set_log_file().
Here is the caller graph for this function:| int write_safe_log | ( | TS_LOG * | log, |
| char * | pat, | ||
| ... | |||
| ) |
write to a thread-safe logging file
| log | A TS_LOG handler |
| pat | Pattern for writting (i.e "%d %d %s") |
Definition at line 404 of file n_log.c.
References TS_LOG::file, and TS_LOG::LOG_MUTEX.
Referenced by main().
Here is the caller graph for this function: