Logging definitions.
More...
#include <stdarg.h>
#include <stdint.h>
Go to the source code of this file.
|
LIB_API_LOG void | ni_log_default_callback (int level, const char *fmt, va_list vl) |
| Default ni_log() callback. More...
|
|
LIB_API_LOG void | ni_log_set_callback (void(*log_callback)(int, const char *, va_list)) |
| Set ni_log() callback. More...
|
|
LIB_API_LOG void | ni_log (ni_log_level_t level, const char *fmt,...) |
| print log message using ni_log_callback More...
|
|
LIB_API_LOG void | ni_log_set_level (ni_log_level_t level) |
| Set ni_log_level. More...
|
|
LIB_API_LOG ni_log_level_t | ni_log_get_level (void) |
| Get ni_log_level. More...
|
|
LIB_API_LOG ni_log_level_t | ff_to_ni_log_level (int fflog_level) |
| Convert ffmpeg log level integer to appropriate ni_log_level_t. More...
|
|
LIB_API_LOG ni_log_level_t | arg_to_ni_log_level (const char *fflog_level) |
| Convert terminal arg string to ni_log_level_t. More...
|
|
LIB_API_LOG uint64_t | ni_log_get_utime () |
| Get time for logs with microsecond timestamps. More...
|
|
LIB_API_LOG void | ni_log2 (const void *p_context, ni_log_level_t level, const char *fmt,...) |
| print log message and additional information using ni_log_callback, More...
|
|
void | ni_log2_with_mutex (int on) |
| set whether to use a lock or not in ni_log2 More...
|
|
Logging definitions.
Definition in file ni_log.h.
◆ ni_log_level_t
Enumerator |
---|
NI_LOG_INVALID | |
NI_LOG_NONE | |
NI_LOG_FATAL | |
NI_LOG_ERROR | |
NI_LOG_INFO | |
NI_LOG_DEBUG | |
NI_LOG_TRACE | |
Definition at line 55 of file ni_log.h.
◆ arg_to_ni_log_level()
LIB_API_LOG ni_log_level_t arg_to_ni_log_level |
( |
const char * |
arg_str | ) |
|
Convert terminal arg string to ni_log_level_t.
- Parameters
-
log_str | character pointer of log level arg in terminal |
- Returns
- ni_log_level
Definition at line 262 of file ni_log.c.
◆ ff_to_ni_log_level()
Convert ffmpeg log level integer to appropriate ni_log_level_t.
- Parameters
-
fflog_level | integer representation of FFmpeg log level |
- Returns
- ni_log_level
Definition at line 224 of file ni_log.c.
◆ ni_log()
LIB_API_LOG void ni_log |
( |
ni_log_level_t |
level, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
print log message using ni_log_callback
- Parameters
-
[in] | level | log level |
[in] | format | printf format specifier |
[in] | ... | additional arguments |
- Returns
Definition at line 183 of file ni_log.c.
◆ ni_log2()
LIB_API_LOG void ni_log2 |
( |
const void * |
p_context, |
|
|
ni_log_level_t |
level, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
print log message and additional information using ni_log_callback,
- Parameters
-
[in] | p_context | a pointer to ni_session_context_t if p_context != NULL session_id/E2EID will be printed as extra information |
[in] | level | log level, if log_level == NI_LOG_ERROR timastamp will be printed as extra information |
[in] | format | printf format specifier |
[in] | ... | additional arguments |
- Returns
Definition at line 337 of file ni_log.c.
◆ ni_log2_with_mutex()
void ni_log2_with_mutex |
( |
int |
on | ) |
|
set whether to use a lock or not in ni_log2
- Parameters
-
[in] | on | whether to use a lock, 1-->use a lock, 0-->use extra buf(no lock) |
- Returns
Definition at line 326 of file ni_log.c.
◆ ni_log_default_callback()
LIB_API_LOG void ni_log_default_callback |
( |
int |
level, |
|
|
const char * |
fmt, |
|
|
va_list |
vl |
|
) |
| |
Default ni_log() callback.
- Parameters
-
[in] | level | log level |
[in] | fmt | printf format specifier |
[in] | vl | variadric args list |
- Returns
- Parameters
-
[in] | level | log level |
[in] | fmt | printf format specifier |
[in] | vl | variadric args list |
- Returns
- Note
- This function doesn't automatically append a newline to the end of the log message.
Definition at line 134 of file ni_log.c.
◆ ni_log_get_level()
Get ni_log_level.
- Returns
- ni_log_level
Definition at line 212 of file ni_log.c.
◆ ni_log_get_utime()
LIB_API_LOG uint64_t ni_log_get_utime |
( |
| ) |
|
Get time for logs with microsecond timestamps.
- Returns
- microsecond timestamp
Definition at line 308 of file ni_log.c.
◆ ni_log_set_callback()
LIB_API_LOG void ni_log_set_callback |
( |
void(*)(int, const char *, va_list) |
log_callback | ) |
|
◆ ni_log_set_level()
Set ni_log_level.
- Parameters
-
- Returns
Definition at line 202 of file ni_log.c.