1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-07-13 01:00:23 +02:00

Remove unused parameter from cmdBegin().

This commit is contained in:
David Steele
2020-08-20 14:16:36 -04:00
parent fccca0d716
commit 859b8a50fd
5 changed files with 16 additions and 24 deletions

View File

@ -158,11 +158,9 @@ cmdOption(void)
/**********************************************************************************************************************************/
void
cmdBegin(bool logOption)
cmdBegin(void)
{
FUNCTION_LOG_BEGIN(logLevelTrace);
FUNCTION_LOG_PARAM(BOOL, logOption);
FUNCTION_LOG_END();
FUNCTION_LOG_VOID(logLevelTrace);
ASSERT(cfgCommand() != cfgCmdNone);
@ -174,15 +172,13 @@ cmdBegin(bool logOption)
// Basic info on command start
String *info = strNewFmt("%s command begin", strZ(cfgCommandRoleName()));
if (logOption)
{
// Free the old option string if it exists. This is needed when more than one command is run in a row so an option
// string gets created for the new command.
strFree(cmdOptionStr);
cmdOptionStr = NULL;
// Add version and options
strCatFmt(info, " %s:%s", PROJECT_VERSION, strZ(cmdOption()));
}
LOG(cfgLogLevelDefault(), 0, strZ(info));
}

View File

@ -13,7 +13,7 @@ Functions
void cmdInit(void);
// Begin the command
void cmdBegin(bool logOption);
void cmdBegin(void);
// Get the command options as a string. This is output in cmdBegin() if the log level is high enough but can also be used for
// debugging or error reporting later on.

View File

@ -364,7 +364,7 @@ cfgLoad(unsigned int argListSize, const char *argList[])
cfgLoadLogFile();
// Begin the command
cmdBegin(true);
cmdBegin();
// Acquire a lock if this command requires a lock
if (cfgLockRequired() && !cfgCommandHelp())

View File

@ -128,7 +128,7 @@ main(int argListSize, const char *argList[])
cmdEnd(0, NULL);
cfgCommandSet(cfgCmdExpire, cfgCmdRoleDefault);
cfgLoadLogFile();
cmdBegin(true);
cmdBegin();
// Run expire
cmdExpire();

View File

@ -33,14 +33,14 @@ testRun(void)
harnessLogLevelSet(logLevelInfo);
TEST_RESULT_VOID(cmdBegin(true), "command begin with command parameter");
TEST_RESULT_VOID(cmdBegin(), "command begin with command parameter");
harnessLogResult(
"P00 INFO: archive-get command begin " PROJECT_VERSION ": [param1] --archive-async");
strLstAddZ(commandParamList, "param 2");
cfgCommandParamSet(commandParamList);
TEST_RESULT_VOID(cmdBegin(true), "command begin with command parameters");
TEST_RESULT_VOID(cmdBegin(), "command begin with command parameters");
harnessLogResult(
"P00 INFO: archive-get command begin " PROJECT_VERSION ": [param1, \"param 2\"] --archive-async");
@ -77,22 +77,18 @@ testRun(void)
cfgOptionSet(cfgOptRecoveryOption, cfgSourceParam, recoveryVar);
cfgCommandSet(cfgCmdRestore, cfgCmdRoleDefault);
TEST_RESULT_VOID(cmdBegin(true), "command begin with option logging");
TEST_RESULT_VOID(cmdBegin(), "command begin with option logging");
harnessLogResult(
"P00 INFO: restore command begin " PROJECT_VERSION ": --no-config --db-include=db1 --db-include=db2"
" --recovery-option=standby_mode=on --recovery-option=primary_conn_info=blah --reset-repo1-host"
" --repo1-path=\"/path/to the/repo\" --repo1-s3-key=<redacted>");
cfgCommandSet(cfgCmdArchiveGet, cfgCmdRoleDefault);
TEST_RESULT_VOID(cmdBegin(true), "command begin with limited option logging");
TEST_RESULT_VOID(cmdBegin(), "command begin with limited option logging");
harnessLogResult(
"P00 INFO: archive-get command begin " PROJECT_VERSION ": --no-config --reset-repo1-host"
" --repo1-path=\"/path/to the/repo\" --repo1-s3-key=<redacted>");
TEST_RESULT_VOID(cmdBegin(false), "command begin no option logging");
harnessLogResult(
"P00 INFO: archive-get command begin");
// -------------------------------------------------------------------------------------------------------------------------
TEST_TITLE("check options in cache");
@ -103,7 +99,7 @@ testRun(void)
// Nothing should be logged for command begin when the log level is too low
// -------------------------------------------------------------------------------------------------------------------------
harnessLogLevelSet(logLevelWarn);
TEST_RESULT_VOID(cmdBegin(true), "command begin no logging");
TEST_RESULT_VOID(cmdBegin(), "command begin no logging");
// Nothing should be logged for command end when the log level is too low
// -------------------------------------------------------------------------------------------------------------------------