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 void
cmdBegin(bool logOption) cmdBegin(void)
{ {
FUNCTION_LOG_BEGIN(logLevelTrace); FUNCTION_LOG_VOID(logLevelTrace);
FUNCTION_LOG_PARAM(BOOL, logOption);
FUNCTION_LOG_END();
ASSERT(cfgCommand() != cfgCmdNone); ASSERT(cfgCommand() != cfgCmdNone);
@ -174,15 +172,13 @@ cmdBegin(bool logOption)
// Basic info on command start // Basic info on command start
String *info = strNewFmt("%s command begin", strZ(cfgCommandRoleName())); 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 // 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. // string gets created for the new command.
strFree(cmdOptionStr); strFree(cmdOptionStr);
cmdOptionStr = NULL; cmdOptionStr = NULL;
// Add version and options
strCatFmt(info, " %s:%s", PROJECT_VERSION, strZ(cmdOption())); strCatFmt(info, " %s:%s", PROJECT_VERSION, strZ(cmdOption()));
}
LOG(cfgLogLevelDefault(), 0, strZ(info)); LOG(cfgLogLevelDefault(), 0, strZ(info));
} }

View File

@ -13,7 +13,7 @@ Functions
void cmdInit(void); void cmdInit(void);
// Begin the command // 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 // 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. // debugging or error reporting later on.

View File

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

View File

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

View File

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