1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00

Remove duplication from FUNCTION_LOG_BEGIN_BASE() macro definitions.

It is a bit simpler to define STACK_TRACE_TEST_START()/STACK_TRACE_TEST_STOP() in a separate #ifdef so FUNCTION_LOG_BEGIN_BASE() does not need to be defined twice.

Also add missing semicolons exposed by this change.
This commit is contained in:
David Steele 2023-01-09 14:47:57 +07:00
parent 6633ccd18d
commit 38d3204553
16 changed files with 36 additions and 41 deletions

View File

@ -24,7 +24,7 @@ Write source file to destination IO
static int static int
storageGetProcess(IoWrite *destination) storageGetProcess(IoWrite *destination)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(IO_READ, destination); FUNCTION_LOG_PARAM(IO_READ, destination);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -80,7 +80,7 @@ storageListRenderInfo(const StorageInfo *const info, IoWrite *const write, const
static void static void
storageListRender(IoWrite *write) storageListRender(IoWrite *write)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(IO_WRITE, write); FUNCTION_LOG_PARAM(IO_WRITE, write);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -21,7 +21,7 @@ Write source IO to destination file
static void static void
storagePutProcess(IoRead *source) storagePutProcess(IoRead *source)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(IO_READ, source); FUNCTION_LOG_PARAM(IO_READ, source);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -19,29 +19,24 @@ level is set to debug or trace.
FUNCTION_LOG_logLevel FUNCTION_LOG_logLevel
#ifdef DEBUG_TEST_TRACE #ifdef DEBUG_TEST_TRACE
#define FUNCTION_LOG_BEGIN_BASE(logLevel) \ #define STACK_TRACE_TEST_START() stackTraceTestStart()
#define STACK_TRACE_TEST_STOP() stackTraceTestStop()
#else
#define STACK_TRACE_TEST_START()
#define STACK_TRACE_TEST_STOP()
#endif
#define FUNCTION_LOG_BEGIN_BASE(logLevel) \
LogLevel FUNCTION_LOG_LEVEL() = STACK_TRACE_PUSH(logLevel); \ LogLevel FUNCTION_LOG_LEVEL() = STACK_TRACE_PUSH(logLevel); \
\ \
{ \ { \
stackTraceParamLog(); \ stackTraceParamLog(); \
stackTraceTestStop(); STACK_TRACE_TEST_STOP()
#define FUNCTION_LOG_END_BASE() \ #define FUNCTION_LOG_END_BASE() \
stackTraceTestStart(); \ STACK_TRACE_TEST_START(); \
LOG_FMT(FUNCTION_LOG_LEVEL(), 0, "(%s)", stackTraceParam()); \ LOG_FMT(FUNCTION_LOG_LEVEL(), 0, "(%s)", stackTraceParam()); \
} }
#else
#define FUNCTION_LOG_BEGIN_BASE(logLevel) \
LogLevel FUNCTION_LOG_LEVEL() = STACK_TRACE_PUSH(logLevel); \
\
if (logAny(FUNCTION_LOG_LEVEL())) \
{ \
stackTraceParamLog();
#define FUNCTION_LOG_END_BASE() \
LOG_FMT(FUNCTION_LOG_LEVEL(), 0, "(%s)", stackTraceParam()); \
}
#endif
/*********************************************************************************************************************************** /***********************************************************************************************************************************
General purpose function debugging macros General purpose function debugging macros

View File

@ -114,7 +114,7 @@ execFreeResource(THIS_VOID)
FN_EXTERN Exec * FN_EXTERN Exec *
execNew(const String *command, const StringList *param, const String *name, TimeMSec timeout) execNew(const String *command, const StringList *param, const String *name, TimeMSec timeout)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STRING, command); FUNCTION_LOG_PARAM(STRING, command);
FUNCTION_LOG_PARAM(STRING_LIST, param); FUNCTION_LOG_PARAM(STRING_LIST, param);
FUNCTION_LOG_PARAM(STRING, name); FUNCTION_LOG_PARAM(STRING, name);
@ -301,7 +301,7 @@ execFdRead(const THIS_VOID)
FN_EXTERN void FN_EXTERN void
execOpen(Exec *this) execOpen(Exec *this)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(EXEC, this); FUNCTION_LOG_PARAM(EXEC, this);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -19,7 +19,7 @@ struct IoClient
FN_EXTERN IoClient * FN_EXTERN IoClient *
ioClientNew(void *driver, const IoClientInterface *interface) ioClientNew(void *driver, const IoClientInterface *interface)
{ {
FUNCTION_LOG_BEGIN(logLevelTrace) FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM_P(VOID, driver); FUNCTION_LOG_PARAM_P(VOID, driver);
FUNCTION_LOG_PARAM(IO_CLIENT_INTERFACE, interface); FUNCTION_LOG_PARAM(IO_CLIENT_INTERFACE, interface);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -34,7 +34,7 @@ struct HttpClient
FN_EXTERN HttpClient * FN_EXTERN HttpClient *
httpClientNew(IoClient *ioClient, TimeMSec timeout) httpClientNew(IoClient *ioClient, TimeMSec timeout)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(IO_CLIENT, ioClient); FUNCTION_LOG_PARAM(IO_CLIENT, ioClient);
FUNCTION_LOG_PARAM(TIME_MSEC, timeout); FUNCTION_LOG_PARAM(TIME_MSEC, timeout);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -59,7 +59,7 @@ Process the request
static HttpResponse * static HttpResponse *
httpRequestProcess(HttpRequest *this, bool waitForResponse, bool contentCache) httpRequestProcess(HttpRequest *this, bool waitForResponse, bool contentCache)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(HTTP_REQUEST, this); FUNCTION_LOG_PARAM(HTTP_REQUEST, this);
FUNCTION_LOG_PARAM(BOOL, waitForResponse); FUNCTION_LOG_PARAM(BOOL, waitForResponse);
FUNCTION_LOG_PARAM(BOOL, contentCache); FUNCTION_LOG_PARAM(BOOL, contentCache);
@ -178,7 +178,7 @@ httpRequestProcess(HttpRequest *this, bool waitForResponse, bool contentCache)
FN_EXTERN HttpRequest * FN_EXTERN HttpRequest *
httpRequestNew(HttpClient *client, const String *verb, const String *path, HttpRequestNewParam param) httpRequestNew(HttpClient *client, const String *verb, const String *path, HttpRequestNewParam param)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(HTTP_CLIENT, client); FUNCTION_LOG_PARAM(HTTP_CLIENT, client);
FUNCTION_LOG_PARAM(STRING, verb); FUNCTION_LOG_PARAM(STRING, verb);
FUNCTION_LOG_PARAM(STRING, path); FUNCTION_LOG_PARAM(STRING, path);
@ -222,7 +222,7 @@ httpRequestNew(HttpClient *client, const String *verb, const String *path, HttpR
FN_EXTERN HttpResponse * FN_EXTERN HttpResponse *
httpRequestResponse(HttpRequest *this, bool contentCache) httpRequestResponse(HttpRequest *this, bool contentCache)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(HTTP_REQUEST, this); FUNCTION_LOG_PARAM(HTTP_REQUEST, this);
FUNCTION_LOG_PARAM(BOOL, contentCache); FUNCTION_LOG_PARAM(BOOL, contentCache);
FUNCTION_LOG_END(); FUNCTION_LOG_END();
@ -236,7 +236,7 @@ httpRequestResponse(HttpRequest *this, bool contentCache)
FN_EXTERN void FN_EXTERN void
httpRequestError(const HttpRequest *this, HttpResponse *response) httpRequestError(const HttpRequest *this, HttpResponse *response)
{ {
FUNCTION_LOG_BEGIN(logLevelTrace) FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM(HTTP_REQUEST, this); FUNCTION_LOG_PARAM(HTTP_REQUEST, this);
FUNCTION_LOG_PARAM(HTTP_RESPONSE, response); FUNCTION_LOG_PARAM(HTTP_RESPONSE, response);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -209,7 +209,7 @@ httpResponseEof(THIS_VOID)
FN_EXTERN HttpResponse * FN_EXTERN HttpResponse *
httpResponseNew(HttpSession *session, const String *verb, bool contentCache) httpResponseNew(HttpSession *session, const String *verb, bool contentCache)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(HTTP_SESSION, session); FUNCTION_LOG_PARAM(HTTP_SESSION, session);
FUNCTION_LOG_PARAM(STRING, verb); FUNCTION_LOG_PARAM(STRING, verb);
FUNCTION_LOG_PARAM(BOOL, contentCache); FUNCTION_LOG_PARAM(BOOL, contentCache);

View File

@ -21,7 +21,7 @@ struct HttpSession
FN_EXTERN HttpSession * FN_EXTERN HttpSession *
httpSessionNew(HttpClient *httpClient, IoSession *ioSession) httpSessionNew(HttpClient *httpClient, IoSession *ioSession)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(HTTP_CLIENT, httpClient); FUNCTION_LOG_PARAM(HTTP_CLIENT, httpClient);
FUNCTION_LOG_PARAM(IO_SESSION, ioSession); FUNCTION_LOG_PARAM(IO_SESSION, ioSession);
FUNCTION_LOG_END(); FUNCTION_LOG_END();
@ -50,7 +50,7 @@ httpSessionNew(HttpClient *httpClient, IoSession *ioSession)
FN_EXTERN void FN_EXTERN void
httpSessionDone(HttpSession *this) httpSessionDone(HttpSession *this)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(HTTP_SESSION, this); FUNCTION_LOG_PARAM(HTTP_SESSION, this);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -20,7 +20,7 @@ struct IoServer
FN_EXTERN IoServer * FN_EXTERN IoServer *
ioServerNew(void *const driver, const IoServerInterface *const interface) ioServerNew(void *const driver, const IoServerInterface *const interface)
{ {
FUNCTION_LOG_BEGIN(logLevelTrace) FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM_P(VOID, driver); FUNCTION_LOG_PARAM_P(VOID, driver);
FUNCTION_LOG_PARAM(IO_SERVER_INTERFACE, interface); FUNCTION_LOG_PARAM(IO_SERVER_INTERFACE, interface);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -19,7 +19,7 @@ struct IoSession
FN_EXTERN IoSession * FN_EXTERN IoSession *
ioSessionNew(void *driver, const IoSessionInterface *interface) ioSessionNew(void *driver, const IoSessionInterface *interface)
{ {
FUNCTION_LOG_BEGIN(logLevelTrace) FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM_P(VOID, driver); FUNCTION_LOG_PARAM_P(VOID, driver);
FUNCTION_LOG_PARAM(IO_SESSION_INTERFACE, interface); FUNCTION_LOG_PARAM(IO_SESSION_INTERFACE, interface);
FUNCTION_LOG_END(); FUNCTION_LOG_END();

View File

@ -161,7 +161,7 @@ static const IoClientInterface sckClientInterface =
FN_EXTERN IoClient * FN_EXTERN IoClient *
sckClientNew(const String *const host, const unsigned int port, const TimeMSec timeoutConnect, const TimeMSec timeoutSession) sckClientNew(const String *const host, const unsigned int port, const TimeMSec timeoutConnect, const TimeMSec timeoutSession)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STRING, host); FUNCTION_LOG_PARAM(STRING, host);
FUNCTION_LOG_PARAM(UINT, port); FUNCTION_LOG_PARAM(UINT, port);
FUNCTION_LOG_PARAM(TIME_MSEC, timeoutConnect); FUNCTION_LOG_PARAM(TIME_MSEC, timeoutConnect);

View File

@ -144,7 +144,7 @@ static const IoServerInterface sckServerInterface =
FN_EXTERN IoServer * FN_EXTERN IoServer *
sckServerNew(const String *const address, const unsigned int port, const TimeMSec timeout) sckServerNew(const String *const address, const unsigned int port, const TimeMSec timeout)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STRING, address); FUNCTION_LOG_PARAM(STRING, address);
FUNCTION_LOG_PARAM(UINT, port); FUNCTION_LOG_PARAM(UINT, port);
FUNCTION_LOG_PARAM(TIME_MSEC, timeout); FUNCTION_LOG_PARAM(TIME_MSEC, timeout);

View File

@ -165,7 +165,7 @@ static const IoSessionInterface sckSessionInterface =
FN_EXTERN IoSession * FN_EXTERN IoSession *
sckSessionNew(IoSessionRole role, int fd, const String *host, unsigned int port, TimeMSec timeout) sckSessionNew(IoSessionRole role, int fd, const String *host, unsigned int port, TimeMSec timeout)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(STRING_ID, role); FUNCTION_LOG_PARAM(STRING_ID, role);
FUNCTION_LOG_PARAM(INT, fd); FUNCTION_LOG_PARAM(INT, fd);
FUNCTION_LOG_PARAM(STRING, host); FUNCTION_LOG_PARAM(STRING, host);

View File

@ -352,7 +352,7 @@ static const IoSessionInterface tlsSessionInterface =
FN_EXTERN IoSession * FN_EXTERN IoSession *
tlsSessionNew(SSL *session, IoSession *ioSession, TimeMSec timeout) tlsSessionNew(SSL *session, IoSession *ioSession, TimeMSec timeout)
{ {
FUNCTION_LOG_BEGIN(logLevelDebug) FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM_P(VOID, session); FUNCTION_LOG_PARAM_P(VOID, session);
FUNCTION_LOG_PARAM(IO_SESSION, ioSession); FUNCTION_LOG_PARAM(IO_SESSION, ioSession);
FUNCTION_LOG_PARAM(TIME_MSEC, timeout); FUNCTION_LOG_PARAM(TIME_MSEC, timeout);