chg: [syslog] output slightly changed

- always have a consistent number of fields conveyed, include delimited ( -- ) fields even if no data is passed to a field
- Avoid linebreaks in content
pull/9685/merge
iglocska 2024-04-18 12:46:11 +02:00
parent a55a19cd09
commit be9ad95905
No known key found for this signature in database
GPG Key ID: BEA224F1FEF113AC
1 changed files with 8 additions and 9 deletions

View File

@ -431,15 +431,14 @@ class Log extends AppModel
}
}
$entry = $data['Log']['action'];
if (!empty($data['Log']['title'])) {
$entry .= " -- {$data['Log']['title']}";
}
if (!empty($data['Log']['description'])) {
$entry .= " -- {$data['Log']['description']}";
} else if (!empty($data['Log']['change'])) {
$entry .= " -- " . JsonTool::encode($data['Log']['change']);
}
$entry = sprintf(
'%s -- %s -- %s',
$data['Log']['action'],
empty($data['Log']['title']) ? '' : $formatted_title = preg_replace('/\s+/', " ", $data['Log']['title']),
empty($data['Log']['description']) ?
(empty($data['Log']['change']) ? '' : preg_replace('/\s+/', " ", $data['Log']['change'])) :
preg_replace('/\s+/', " ", $data['Log']['description'])
);
$this->syslog->write($action, $entry);
}
}