Log implementation.
More...
#include "compile_time.h"
#include "src/lib/log.h"
#include "dist/sds/sds.h"
#include "src/lib/env.h"
#include <pthread.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
◆ get_loglevel_name()
| const char * get_loglevel_name |
( |
int |
level | ) |
|
Returns the name of the loglevel
- Parameters
-
- Returns
- the loglevel name or empty string if loglevel is invalid
◆ log_init()
Initializes the logging sub-system
◆ mympd_log()
| void mympd_log |
( |
int |
level, |
|
|
const char * |
file, |
|
|
int |
line, |
|
|
const char * |
partition, |
|
|
const char * |
fmt, |
|
|
|
... |
|
) |
| |
Logs the errno string This function should be called by the suitable macro
- Parameters
-
| level | loglevel of the message |
| file | filename for debug logging |
| line | linenumber for debug logging |
| partition | mpd partition |
| fmt | format string to print |
| ... | arguments for the format string |
◆ mympd_log_errno()
| void mympd_log_errno |
( |
const char * |
file, |
|
|
int |
line, |
|
|
const char * |
partition, |
|
|
int |
errnum |
|
) |
| |
Logs the errno string This function should be called by the suitable macro
- Parameters
-
| file | filename for debug logging |
| line | linenumber for debug logging |
| partition | mpd partition |
| errnum | errno |
◆ set_loglevel()
| void set_loglevel |
( |
int |
level | ) |
|
Sets the loglevel
- Parameters
-
◆ log_type
◆ loglevel
◆ loglevel_colors
| const char* loglevel_colors[8] |
|
static |
Initial value:= {
[LOG_EMERG] = "\033[0;31m",
[LOG_ALERT] = "\033[0;31m",
[LOG_CRIT] = "\033[0;31m",
[LOG_ERR] = "\033[0;31m",
[LOG_WARNING] = "\033[0;33m",
[LOG_NOTICE] = "",
[LOG_INFO] = "",
[LOG_DEBUG] = "\033[0;32m"
}
Maps loglevels to terminal colors
◆ loglevel_names
| const char* loglevel_names[8] |
|
static |
Initial value:= {
[LOG_EMERG] = "EMERG",
[LOG_ALERT] = "ALERT",
[LOG_CRIT] = "CRITICAL",
[LOG_ERR] = "ERROR",
[LOG_WARNING] = "WARN",
[LOG_NOTICE] = "NOTICE",
[LOG_INFO] = "INFO",
[LOG_DEBUG] = "DEBUG"
}
Maps loglevels to names
◆ thread_logname
| _Thread_local sds thread_logname |
Global variables Thread name