Skip to content

Commit

Permalink
Merge pull request #30484 from eileenmcnaughton/pear
Browse files Browse the repository at this point in the history
Update pear/log to 1.14.4
  • Loading branch information
demeritcowboy authored Jun 20, 2024
2 parents 9c1e82d + 3f82c72 commit 7fbe8d9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion CRM/Core/Error.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ public static function debug_query_result($query) {
public static function createDebugLogger($prefix = '') {
self::generateLogFileName($prefix);
$log = Log::singleton('file', \Civi::$statics[__CLASS__]['logger_file' . $prefix], '', [
'timeFormat' => '%Y-%m-%d %H:%M:%S%z',
'timeFormat' => 'Y-m-d H:i:sO',
]);
if (is_callable([$log, 'setLocale'])) {
$log->setLocale(CRM_Core_I18n::getLocale());
Expand Down
2 changes: 1 addition & 1 deletion Civi/API/LogObserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class LogObserver extends \Log_observer {
* @see \Log::_announce
* @param array $event
*/
public function notify($event) {
public function notify(array $event): void {
$levels = \CRM_Core_Error_Log::getMap();
$event['level'] = array_search($event['priority'], $levels);
// Extract [civi.tag] from message string
Expand Down
5 changes: 1 addition & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"guzzlehttp/guzzle": "^6.3 || ^7.3",
"psr/simple-cache": "~1.0.1",
"cweagans/composer-patches": "~1.0",
"pear/log": "1.13.3",
"pear/log": "1.14.4",
"adrienrn/php-mimetyper": "0.2.2",
"civicrm/composer-downloads-plugin": "^3.0 || ^4.0",
"league/csv": "~9.7.4",
Expand Down Expand Up @@ -274,9 +274,6 @@
"pear/db": {
"Apply CiviCRM Customisations for the pear:db package": "https://raw.githubusercontent.com/civicrm/civicrm-core/2ad420c394/tools/scripts/composer/pear_db_civicrm_changes.patch"
},
"pear/log": {
"Apply patch for php8.1": "https://gist.githubusercontent.com/totten/d99d47dd9d19a5cb02858954a5577609/raw/0e5e4628a475219c2aec6af76e69894cdec42a55/pear-log-locale.patch"
},
"pear/mail": {
"Apply CiviCRM Customisations for CRM-1367 and CRM-5946": "https://raw.githubusercontent.com/civicrm/civicrm-core/36319938a5bf26c1e7e2110a26a65db6a5979268/tools/scripts/composer/patches/pear-mail.patch"
},
Expand Down
17 changes: 9 additions & 8 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions tests/phpunit/CRM/Core/ErrorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ public function testDebugLoggerFormat(): void {
$log->log('Mary had a little lamb');
$log->log('Little lamb');
$config = CRM_Core_Config::singleton();
$fileContents = file_get_contents($log->_filename);
$this->assertEquals($config->configAndLogDir . 'CiviCRM.' . CIVICRM_DOMAIN_ID . '.' . 'my-test.' . CRM_Core_Error::generateLogFileHash($config) . '.log', $log->_filename);
$fileContents = file_get_contents($config->configAndLogDir . 'CiviCRM.' . CIVICRM_DOMAIN_ID . '.' . 'my-test.' . CRM_Core_Error::generateLogFileHash($config) . '.log');
// The 5 here is a bit arbitrary - on my local the date part is 15 chars (Mar 29 05:29:16) - but we are just checking that
// there are chars for the date at the start.
$this->assertTrue(strpos($fileContents, '[info] Mary had a little lamb') > 10);
Expand Down

0 comments on commit 7fbe8d9

Please sign in to comment.