Skip to content

Commit

Permalink
Convert ArchiveMode enum to StringId.
Browse files Browse the repository at this point in the history
Improves debug logging by outputting get/push instead of 0/1.
  • Loading branch information
dwsteele committed Apr 28, 2021
1 parent 7dd0189 commit 8394577
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
1 change: 1 addition & 0 deletions doc/xml/release.xml
Expand Up @@ -95,6 +95,7 @@
</commit>
<commit subject="Convert ProtocolParallelJobState enum to StringId."/>
<commit subject="Convert ProtocolStorageType enum to StringId."/>
<commit subject="Convert ArchiveMode enum to StringId."/>

<release-item-contributor-list>
<release-item-reviewer id="cynthia.shang"/>
Expand Down
12 changes: 6 additions & 6 deletions src/command/archive/common.c
Expand Up @@ -46,7 +46,7 @@ static const String *
archiveAsyncSpoolQueue(ArchiveMode archiveMode)
{
FUNCTION_TEST_BEGIN();
FUNCTION_TEST_PARAM(ENUM, archiveMode);
FUNCTION_TEST_PARAM(STRING_ID, archiveMode);
FUNCTION_TEST_END();

FUNCTION_TEST_RETURN((archiveMode == archiveModeGet ? STORAGE_SPOOL_ARCHIVE_IN_STR : STORAGE_SPOOL_ARCHIVE_OUT_STR));
Expand All @@ -57,7 +57,7 @@ void
archiveAsyncErrorClear(ArchiveMode archiveMode, const String *archiveFile)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(ENUM, archiveMode);
FUNCTION_LOG_PARAM(STRING_ID, archiveMode);
FUNCTION_LOG_PARAM(STRING, archiveFile);
FUNCTION_LOG_END();

Expand All @@ -74,7 +74,7 @@ bool
archiveAsyncStatus(ArchiveMode archiveMode, const String *walSegment, bool throwOnError)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(ENUM, archiveMode);
FUNCTION_LOG_PARAM(STRING_ID, archiveMode);
FUNCTION_LOG_PARAM(STRING, walSegment);
FUNCTION_LOG_PARAM(BOOL, throwOnError);
FUNCTION_LOG_END();
Expand Down Expand Up @@ -179,7 +179,7 @@ void
archiveAsyncStatusErrorWrite(ArchiveMode archiveMode, const String *walSegment, int code, const String *message)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(ENUM, archiveMode);
FUNCTION_LOG_PARAM(STRING_ID, archiveMode);
FUNCTION_LOG_PARAM(STRING, walSegment);
FUNCTION_LOG_PARAM(INT, code);
FUNCTION_LOG_PARAM(STRING, message);
Expand Down Expand Up @@ -208,7 +208,7 @@ void
archiveAsyncStatusOkWrite(ArchiveMode archiveMode, const String *walSegment, const String *warning)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(ENUM, archiveMode);
FUNCTION_LOG_PARAM(STRING_ID, archiveMode);
FUNCTION_LOG_PARAM(STRING, walSegment);
FUNCTION_LOG_PARAM(STRING, warning);
FUNCTION_LOG_END();
Expand All @@ -233,7 +233,7 @@ void
archiveAsyncExec(ArchiveMode archiveMode, const StringList *commandExec)
{
FUNCTION_LOG_BEGIN(logLevelDebug);
FUNCTION_LOG_PARAM(ENUM, archiveMode);
FUNCTION_LOG_PARAM(STRING_ID, archiveMode);
FUNCTION_LOG_PARAM(STRING_LIST, commandExec);
FUNCTION_LOG_END();

Expand Down
6 changes: 4 additions & 2 deletions src/command/archive/common.h
Expand Up @@ -6,15 +6,17 @@ Archive Common

#include <sys/types.h>

#include "common/type/stringId.h"

/***********************************************************************************************************************************
Archive mode enum
Used for functions that are common to both archive-push and archive-get so they can tailor their behavior to the command being run.
***********************************************************************************************************************************/
typedef enum
{
archiveModePush,
archiveModeGet,
archiveModeGet = STRID5("get", 0x50a70),
archiveModePush = STRID5("push", 0x44eb00),
} ArchiveMode;

#include "common/compress/helper.h"
Expand Down

0 comments on commit 8394577

Please sign in to comment.