* 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,
* @param string $message
* @param array $context
*/
- public function log($level, $message, array $context = []) {
+ public function log($level, $message, array $context = []): void {
// FIXME: This flattens a $context a bit prematurely. When integrating
// with external/CMS logs, we should pass through $context.
if (!empty($context)) {
$context['exception'] = CRM_Core_Error::formatTextException($context['exception']);
}
$message .= "\n" . print_r($context, 1);
-
- if (CRM_Utils_System::isDevelopment() && CRM_Utils_Array::value('civi.tag', $context) === 'deprecated') {
- trigger_error($message, E_USER_DEPRECATED);
- }
}
CRM_Core_Error::debug_log_message($message, FALSE, '', $this->map[$level]);
}