X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FUtils.php;h=cb30595f13cac0c977ce2aa0f7cdf554d345a3fe;hb=478ce8afb467d59eb3dce5ec4a9e9446b134aecf;hp=a9a10ece572a02e36c151931c719be739894faaa;hpb=73151d95469b6aee727f3c1f55c07bb91346f9d3;p=github%2Fshaarli%2FShaarli.git diff --git a/application/Utils.php b/application/Utils.php index a9a10ece..cb30595f 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -6,14 +6,19 @@ /** * Logs a message to a text file * + * The log format is compatible with fail2ban. + * * @param string $logFile where to write the logs * @param string $clientIp the client's remote IPv4/IPv6 address * @param string $message the message to log */ function logm($logFile, $clientIp, $message) { - $line = strval(date('Y/m/d_H:i:s')).' - '.$clientIp.' - '.strval($message).'\n'; - file_put_contents($logFile, $line, FILE_APPEND); + file_put_contents( + $logFile, + date('Y/m/d H:i:s').' - '.$clientIp.' - '.strval($message).'\n', + FILE_APPEND + ); } /**