![]() |
SCTC
the soundcloud.com terminal client
|
Go to the source code of this file.
Macros | |
| #define | _log(...) __log(__FILE__, __LINE__, __func__, __VA_ARGS__) |
Functions | |
| bool | log_init (char *file) |
| void | __log (char *srcfile, int srcline, const char *srcfunc, char *fmt,...) |
| void | log_close () |
| #define _log | ( | ... | ) | __log(__FILE__, __LINE__, __func__, __VA_ARGS__) |
Write a line to the logfile.
A timestamp it prepended to the line and the location of the call to _log is appended.
Format of timestamp: "Wed Jun 30 21:49:08 1993".
Format of the location: "{ in function_name (file_name.c:line_number) }"
Calling _log() prior to log_init() or after log_close() does not have any effect.
Due to the synchronisation of __log(), _log() may be called by several threads 'at once' as well.
| void __log | ( | char * | srcfile, |
| int | srcline, | ||
| const char * | srcfunc, | ||
| char * | fmt, | ||
| ... | |||
| ) |
The internal implementation for logging.
This function is synchronized internally and therefore may be called by several threads 'at once'.
| srcfile | The file executing the call to __log(); filled by macro _log(), do not use "by hand" |
| srcline | The line in the file executing the call to __log(); filled by macro _log(), do not use "by hand" |
| srcfunc | The function callint __log(); filled by macro _log(), do not use "by hand" |
| fmt | The format used format the line, see man 3 printf for usage. |
| void log_close | ( | ) |
Finalize logging.
Closes any opened descriptors and frees any remaining memory allocated during usage. Any calls to _log() after call to log_close() do not have any effect.
Typically this function is only called prior to termination.
| bool log_init | ( | char * | file | ) |
Initialize logging.
Initialize logging and thus allow subsequent calls to _log().
Typically this function is called only once directly after starting up the execution
| file | The file to log to, either relative or absolute path. |
1.8.9.1