Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable10] occ log:manage level #28683

Merged
merged 2 commits into from Aug 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion core/Command/Log/Manage.php
Expand Up @@ -59,7 +59,7 @@ protected function configure() {
'level',
null,
InputOption::VALUE_REQUIRED,
'set the log level [debug, info, warning, error]'
'set the log level [debug, info, warning, error, fatal]'
)
->addOption(
'timezone',
Expand Down Expand Up @@ -149,6 +149,8 @@ protected function convertLevelString($level) {
case 'error':
case 'err':
return 3;
case 'fatal':
return 4;
}
throw new \InvalidArgumentException('Invalid log level string');
}
Expand All @@ -168,7 +170,10 @@ protected function convertLevelNumber($levelNum) {
return 'Warning';
case 3:
return 'Error';
case 4:
return 'Fatal';
}
throw new \InvalidArgumentException('Invalid log level number');
}
}

8 changes: 4 additions & 4 deletions tests/TestHelpers/LoggingHelper.php
Expand Up @@ -57,7 +57,7 @@ public static function getLogFilePath($ocPath) {
}

/**
* returns the currently set log level [debug, info, warning, error]
* returns the currently set log level [debug, info, warning, error, fatal]
*
* @param string $ocPath
* @throws \Exception
Expand All @@ -80,13 +80,13 @@ public static function getLogLevel($ocPath) {
/**
*
* @param string $ocPath
* @param string $logLevel (debug|info|warning|error)
* @param string $logLevel (debug|info|warning|error|fatal)
* @return void
* @throws \InvalidArgumentException
* @throws \Exception
*/
public static function setLogLevel($ocPath, $logLevel) {
if (!in_array($logLevel, ["debug", "info", "warning", "error"])) {
if (!in_array($logLevel, ["debug", "info", "warning", "error", "fatal"])) {
throw new \InvalidArgumentException("invalid log level");
}
$result = SetupHelper::runOcc(["log:manage", "--level=$logLevel"], $ocPath);
Expand Down Expand Up @@ -282,4 +282,4 @@ public static function tailFile(
}
return $output;
}
}
}