diff options
author | kikht <kikht@yandex-team.ru> | 2022-02-10 16:45:14 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:45:14 +0300 |
commit | 778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5 (patch) | |
tree | be835aa92c6248212e705f25388ebafcf84bc7a1 /contrib/libs/libevent/log.c | |
parent | 194cae0e8855b11be2005e1eff12c660c3ee9774 (diff) | |
download | ydb-778e51ba091dc39e7b7fcab2b9cf4dbedfb6f2b5.tar.gz |
Restoring authorship annotation for <kikht@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/libevent/log.c')
-rw-r--r-- | contrib/libs/libevent/log.c | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/contrib/libs/libevent/log.c b/contrib/libs/libevent/log.c index da480ecb21..a9debb864e 100644 --- a/contrib/libs/libevent/log.c +++ b/contrib/libs/libevent/log.c @@ -38,9 +38,9 @@ */ #include "event2/event-config.h" -#include "evconfig-private.h" +#include "evconfig-private.h" -#ifdef _WIN32 +#ifdef _WIN32 #include <winsock2.h> #define WIN32_LEAN_AND_MEAN #include <windows.h> @@ -62,25 +62,25 @@ static void event_exit(int errcode) EV_NORETURN; static event_fatal_cb fatal_fn = NULL; -#ifdef EVENT_DEBUG_LOGGING_ENABLED -#ifdef USE_DEBUG -#define DEFAULT_MASK EVENT_DBG_ALL -#else -#define DEFAULT_MASK 0 -#endif - -EVENT2_EXPORT_SYMBOL ev_uint32_t event_debug_logging_mask_ = DEFAULT_MASK; -#endif /* EVENT_DEBUG_LOGGING_ENABLED */ - +#ifdef EVENT_DEBUG_LOGGING_ENABLED +#ifdef USE_DEBUG +#define DEFAULT_MASK EVENT_DBG_ALL +#else +#define DEFAULT_MASK 0 +#endif + +EVENT2_EXPORT_SYMBOL ev_uint32_t event_debug_logging_mask_ = DEFAULT_MASK; +#endif /* EVENT_DEBUG_LOGGING_ENABLED */ + +void +event_enable_debug_logging(ev_uint32_t which) +{ +#ifdef EVENT_DEBUG_LOGGING_ENABLED + event_debug_logging_mask_ = which; +#endif +} + void -event_enable_debug_logging(ev_uint32_t which) -{ -#ifdef EVENT_DEBUG_LOGGING_ENABLED - event_debug_logging_mask_ = which; -#endif -} - -void event_set_fatal_callback(event_fatal_cb cb) { fatal_fn = cb; @@ -92,7 +92,7 @@ event_exit(int errcode) if (fatal_fn) { fatal_fn(errcode); exit(errcode); /* should never be reached */ - } else if (errcode == EVENT_ERR_ABORT_) + } else if (errcode == EVENT_ERR_ABORT_) abort(); else exit(errcode); @@ -104,7 +104,7 @@ event_err(int eval, const char *fmt, ...) va_list ap; va_start(ap, fmt); - event_logv_(EVENT_LOG_ERR, strerror(errno), fmt, ap); + event_logv_(EVENT_LOG_ERR, strerror(errno), fmt, ap); va_end(ap); event_exit(eval); } @@ -115,7 +115,7 @@ event_warn(const char *fmt, ...) va_list ap; va_start(ap, fmt); - event_logv_(EVENT_LOG_WARN, strerror(errno), fmt, ap); + event_logv_(EVENT_LOG_WARN, strerror(errno), fmt, ap); va_end(ap); } @@ -126,7 +126,7 @@ event_sock_err(int eval, evutil_socket_t sock, const char *fmt, ...) int err = evutil_socket_geterror(sock); va_start(ap, fmt); - event_logv_(EVENT_LOG_ERR, evutil_socket_error_to_string(err), fmt, ap); + event_logv_(EVENT_LOG_ERR, evutil_socket_error_to_string(err), fmt, ap); va_end(ap); event_exit(eval); } @@ -138,7 +138,7 @@ event_sock_warn(evutil_socket_t sock, const char *fmt, ...) int err = evutil_socket_geterror(sock); va_start(ap, fmt); - event_logv_(EVENT_LOG_WARN, evutil_socket_error_to_string(err), fmt, ap); + event_logv_(EVENT_LOG_WARN, evutil_socket_error_to_string(err), fmt, ap); va_end(ap); } @@ -148,7 +148,7 @@ event_errx(int eval, const char *fmt, ...) va_list ap; va_start(ap, fmt); - event_logv_(EVENT_LOG_ERR, NULL, fmt, ap); + event_logv_(EVENT_LOG_ERR, NULL, fmt, ap); va_end(ap); event_exit(eval); } @@ -159,7 +159,7 @@ event_warnx(const char *fmt, ...) va_list ap; va_start(ap, fmt); - event_logv_(EVENT_LOG_WARN, NULL, fmt, ap); + event_logv_(EVENT_LOG_WARN, NULL, fmt, ap); va_end(ap); } @@ -169,29 +169,29 @@ event_msgx(const char *fmt, ...) va_list ap; va_start(ap, fmt); - event_logv_(EVENT_LOG_MSG, NULL, fmt, ap); + event_logv_(EVENT_LOG_MSG, NULL, fmt, ap); va_end(ap); } void -event_debugx_(const char *fmt, ...) +event_debugx_(const char *fmt, ...) { va_list ap; va_start(ap, fmt); - event_logv_(EVENT_LOG_DEBUG, NULL, fmt, ap); + event_logv_(EVENT_LOG_DEBUG, NULL, fmt, ap); va_end(ap); } -void -event_logv_(int severity, const char *errstr, const char *fmt, va_list ap) +void +event_logv_(int severity, const char *errstr, const char *fmt, va_list ap) { char buf[1024]; size_t len; - if (severity == EVENT_LOG_DEBUG && !event_debug_get_logging_mask_()) - return; - + if (severity == EVENT_LOG_DEBUG && !event_debug_get_logging_mask_()) + return; + if (fmt != NULL) evutil_vsnprintf(buf, sizeof(buf), fmt, ap); else @@ -223,16 +223,16 @@ event_log(int severity, const char *msg) else { const char *severity_str; switch (severity) { - case EVENT_LOG_DEBUG: + case EVENT_LOG_DEBUG: severity_str = "debug"; break; - case EVENT_LOG_MSG: + case EVENT_LOG_MSG: severity_str = "msg"; break; - case EVENT_LOG_WARN: + case EVENT_LOG_WARN: severity_str = "warn"; break; - case EVENT_LOG_ERR: + case EVENT_LOG_ERR: severity_str = "err"; break; default: |