mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Add function names to log_* on non-gcc
svn:r6039
This commit is contained in:
parent
49ed6a1f40
commit
42f14e8e10
@ -264,47 +264,47 @@ _log_fn(int severity, uint32_t domain, const char *format, ...)
|
|||||||
_log_fn_function_name = NULL;
|
_log_fn_function_name = NULL;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
log_debug(uint32_t domain, const char *format, ...)
|
_log_debug(uint32_t domain, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap,format);
|
va_start(ap,format);
|
||||||
logv(LOG_DEBUG, domain, NULL, format, ap);
|
logv(LOG_DEBUG, domain, _log_fn_function_name, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
_log_fn_function_name = NULL;
|
_log_fn_function_name = NULL;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
log_info(uint32_t domain, const char *format, ...)
|
_log_info(uint32_t domain, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap,format);
|
va_start(ap,format);
|
||||||
logv(LOG_INFO, domain, NULL, format, ap);
|
logv(LOG_INFO, domain, _log_fn_function_name, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
_log_fn_function_name = NULL;
|
_log_fn_function_name = NULL;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
log_notice(uint32_t domain, const char *format, ...)
|
_log_notice(uint32_t domain, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap,format);
|
va_start(ap,format);
|
||||||
logv(LOG_NOTICE, domain, NULL, format, ap);
|
logv(LOG_NOTICE, domain, _log_fn_function_name, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
_log_fn_function_name = NULL;
|
_log_fn_function_name = NULL;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
log_warn(uint32_t domain, const char *format, ...)
|
_log_warn(uint32_t domain, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap,format);
|
va_start(ap,format);
|
||||||
logv(LOG_WARN, domain, NULL, format, ap);
|
logv(LOG_WARN, domain, _log_fn_function_name, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
_log_fn_function_name = NULL;
|
_log_fn_function_name = NULL;
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
log_err(uint32_t domain, const char *format, ...)
|
_log_err(uint32_t domain, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap,format);
|
va_start(ap,format);
|
||||||
logv(LOG_ERR, domain, NULL, format, ap);
|
logv(LOG_ERR, domain, _log_fn_function_name, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
_log_fn_function_name = NULL;
|
_log_fn_function_name = NULL;
|
||||||
}
|
}
|
||||||
|
@ -142,15 +142,20 @@ void _log_fn(int severity, uint32_t domain,
|
|||||||
#else /* ! defined(__GNUC__) */
|
#else /* ! defined(__GNUC__) */
|
||||||
|
|
||||||
void _log_fn(int severity, uint32_t domain, const char *format, ...);
|
void _log_fn(int severity, uint32_t domain, const char *format, ...);
|
||||||
void log_debug(uint32_t domain, const char *format, ...);
|
void _log_debug(uint32_t domain, const char *format, ...);
|
||||||
void log_info(uint32_t domain, const char *format, ...);
|
void _log_info(uint32_t domain, const char *format, ...);
|
||||||
void log_notice(uint32_t domain, const char *format, ...);
|
void _log_notice(uint32_t domain, const char *format, ...);
|
||||||
void log_warn(uint32_t domain, const char *format, ...);
|
void _log_warn(uint32_t domain, const char *format, ...);
|
||||||
void log_err(uint32_t domain, const char *format, ...);
|
void _log_err(uint32_t domain, const char *format, ...);
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1300
|
#if defined(_MSC_VER) && _MSC_VER < 1300
|
||||||
/* MSVC 6 and earlier don't have __FUNCTION__, or even __LINE__. */
|
/* MSVC 6 and earlier don't have __FUNCTION__, or even __LINE__. */
|
||||||
#define log_fn _log_fn
|
#define log_fn _log_fn
|
||||||
|
#define log_debug _log_debug
|
||||||
|
#define log_info _log_info
|
||||||
|
#define log_notice _log_notice
|
||||||
|
#define log_warn _log_warn
|
||||||
|
#define log_err _log_err
|
||||||
/*
|
/*
|
||||||
#define debug _debug
|
#define debug _debug
|
||||||
#define info _info
|
#define info _info
|
||||||
@ -166,6 +171,11 @@ extern const char *_log_fn_function_name;
|
|||||||
* do {...} while (0) trick to wrap this macro, since the macro can't take
|
* do {...} while (0) trick to wrap this macro, since the macro can't take
|
||||||
* arguments. */
|
* arguments. */
|
||||||
#define log_fn (_log_fn_function_name=__FUNCTION__),_log_fn
|
#define log_fn (_log_fn_function_name=__FUNCTION__),_log_fn
|
||||||
|
#define log_debug (_log_fn_function_name=__FUNCTION__),_log_debug
|
||||||
|
#define log_info (_log_fn_function_name=__FUNCTION__),_log_info
|
||||||
|
#define log_notice (_log_fn_function_name=__FUNCTION__),_log_notice
|
||||||
|
#define log_warn (_log_fn_function_name=__FUNCTION__),_log_warn
|
||||||
|
#define log_err (_log_fn_function_name=__FUNCTION__),_log_err
|
||||||
/*
|
/*
|
||||||
#define debug (_log_fn_function_name=__FUNCTION__),_debug
|
#define debug (_log_fn_function_name=__FUNCTION__),_debug
|
||||||
#define info (_log_fn_function_name=__FUNCTION__),_info
|
#define info (_log_fn_function_name=__FUNCTION__),_info
|
||||||
|
Loading…
Reference in New Issue
Block a user