X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=log.h;h=abea126b916e3a81b5c8c20e69bd799b2cdb25b9;hp=232798afc26c4287a5c684435f36971c67e13e20;hb=a5dab5ce0fd4aafc394afe30eda0e6b01a13256b;hpb=a65d570117dc73a3af5084319b645ab1556562e5 diff --git a/log.h b/log.h index 232798afc..abea126b9 100644 --- a/log.h +++ b/log.h @@ -26,6 +26,27 @@ #include "macro.h" +typedef enum LogTarget{ + LOG_TARGET_CONSOLE, + LOG_TARGET_SYSLOG, + LOG_TARGET_KMSG, + _LOG_TARGET_MAX, + _LOG_TARGET_INVALID = -1 +} LogTarget; + +void log_set_target(LogTarget target); +void log_set_max_level(int level); + +int log_set_target_from_string(const char *e); +int log_set_max_level_from_string(const char *e); + +void log_close_kmsg(void); +int log_open_kmsg(void); +void log_close_syslog(void); +int log_open_syslog(void); + +void log_parse_environment(void); + void log_meta( int level, const char*file, @@ -39,4 +60,7 @@ void log_meta( #define log_warning(...) log_meta(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__) #define log_error(...) log_meta(LOG_ERR, __FILE__, __LINE__, __func__, __VA_ARGS__) +const char *log_target_to_string(LogTarget target); +LogTarget log_target_from_string(const char *s); + #endif