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

Fix enotice when Log service is swapped out #20146

Merged
merged 1 commit into from
May 5, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion CRM/Core/Error/Log.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ class CRM_Core_Error_Log extends \Psr\Log\AbstractLogger {
* CRM_Core_Error_Log constructor.
*/
public function __construct() {
$this->map = [
$this->map = self::getMap();
}

/**
* @return array
*/
public static function getMap():array {
return [
\Psr\Log\LogLevel::DEBUG => PEAR_LOG_DEBUG,
\Psr\Log\LogLevel::INFO => PEAR_LOG_INFO,
\Psr\Log\LogLevel::NOTICE => PEAR_LOG_NOTICE,
Expand Down
2 changes: 1 addition & 1 deletion Civi/API/LogObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class LogObserver extends \Log_observer {
* @param array $event
*/
public function notify($event) {
$levels = \Civi::log()->map;
$levels = \CRM_Core_Error_Log::getMap();
$event['level'] = array_search($event['priority'], $levels);
// Extract [civi.tag] from message string
// As noted in \CRM_Core_Error_Log::log() the $context array gets prematurely converted to string with print_r() so we have to un-flatten it here
Expand Down