Add function names to log_* on non-gcc

svn:r6039
This commit is contained in:
Peter Palfrader 2006-02-18 07:18:14 +00:00
parent 49ed6a1f40
commit 42f14e8e10
2 changed files with 25 additions and 15 deletions

View File

@ -264,47 +264,47 @@ _log_fn(int severity, uint32_t domain, const char *format, ...)
_log_fn_function_name = NULL;
}
void
log_debug(uint32_t domain, const char *format, ...)
_log_debug(uint32_t domain, const char *format, ...)
{
va_list ap;
va_start(ap,format);
logv(LOG_DEBUG, domain, NULL, format, ap);
logv(LOG_DEBUG, domain, _log_fn_function_name, format, ap);
va_end(ap);
_log_fn_function_name = NULL;
}
void
log_info(uint32_t domain, const char *format, ...)
_log_info(uint32_t domain, const char *format, ...)
{
va_list ap;
va_start(ap,format);
logv(LOG_INFO, domain, NULL, format, ap);
logv(LOG_INFO, domain, _log_fn_function_name, format, ap);
va_end(ap);
_log_fn_function_name = NULL;
}
void
log_notice(uint32_t domain, const char *format, ...)
_log_notice(uint32_t domain, const char *format, ...)
{
va_list ap;
va_start(ap,format);
logv(LOG_NOTICE, domain, NULL, format, ap);
logv(LOG_NOTICE, domain, _log_fn_function_name, format, ap);
va_end(ap);
_log_fn_function_name = NULL;
}
void
log_warn(uint32_t domain, const char *format, ...)
_log_warn(uint32_t domain, const char *format, ...)
{
va_list ap;
va_start(ap,format);
logv(LOG_WARN, domain, NULL, format, ap);
logv(LOG_WARN, domain, _log_fn_function_name, format, ap);
va_end(ap);
_log_fn_function_name = NULL;
}
void
log_err(uint32_t domain, const char *format, ...)
_log_err(uint32_t domain, const char *format, ...)
{
va_list ap;
va_start(ap,format);
logv(LOG_ERR, domain, NULL, format, ap);
logv(LOG_ERR, domain, _log_fn_function_name, format, ap);
va_end(ap);
_log_fn_function_name = NULL;
}

View File

@ -142,15 +142,20 @@ void _log_fn(int severity, uint32_t domain,
#else /* ! defined(__GNUC__) */
void _log_fn(int severity, 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_notice(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_debug(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_warn(uint32_t domain, const char *format, ...);
void _log_err(uint32_t domain, const char *format, ...);
#if defined(_MSC_VER) && _MSC_VER < 1300
/* MSVC 6 and earlier don't have __FUNCTION__, or even __LINE__. */
#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 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
* arguments. */
#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 info (_log_fn_function_name=__FUNCTION__),_info