2022-10-02 00:47:11 -04:00
|
|
|
#include <unistd.h>
|
|
|
|
|
2022-09-22 17:43:21 -04:00
|
|
|
#include <libreborn/log.h>
|
|
|
|
|
|
|
|
// Debug Tag
|
|
|
|
const char *reborn_debug_tag = "";
|
2022-10-02 00:47:11 -04:00
|
|
|
|
|
|
|
// Debug FD
|
|
|
|
int reborn_get_debug_fd() {
|
2024-05-12 03:19:01 -04:00
|
|
|
if (getenv(MCPI_DEBUG_ENV) != NULL) {
|
2022-10-02 00:47:11 -04:00
|
|
|
return STDERR_FILENO;
|
|
|
|
} else {
|
|
|
|
static int debug_fd = -1;
|
|
|
|
if (debug_fd == -1) {
|
|
|
|
const char *log_file_fd_env = getenv("MCPI_LOG_FILE_FD");
|
|
|
|
if (log_file_fd_env == NULL) {
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
debug_fd = atoi(log_file_fd_env);
|
|
|
|
}
|
|
|
|
return debug_fd;
|
|
|
|
}
|
|
|
|
}
|