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']; $entry = sprintf(
if (!empty($data['Log']['title'])) { '%s -- %s -- %s',
$entry .= " -- {$data['Log']['title']}"; $data['Log']['action'],
} empty($data['Log']['title']) ? '' : $formatted_title = preg_replace('/\s+/', " ", $data['Log']['title']),
if (!empty($data['Log']['description'])) { empty($data['Log']['description']) ?
$entry .= " -- {$data['Log']['description']}"; (empty($data['Log']['change']) ? '' : preg_replace('/\s+/', " ", $data['Log']['change'])) :
} else if (!empty($data['Log']['change'])) { preg_replace('/\s+/', " ", $data['Log']['description'])
$entry .= " -- " . JsonTool::encode($data['Log']['change']); );
}
$this->syslog->write($action, $entry); $this->syslog->write($action, $entry);
} }
} }