X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=application%2FUtils.php;h=a9a10ece572a02e36c151931c719be739894faaa;hb=1abe655597da7b3c5b59146c4351eef59f69514c;hp=aeaef9ff143a84e67f16bb99365fcdbd70680608;hpb=92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44;p=github%2Fshaarli%2FShaarli.git diff --git a/application/Utils.php b/application/Utils.php index aeaef9ff..a9a10ece 100644 --- a/application/Utils.php +++ b/application/Utils.php @@ -3,6 +3,19 @@ * Shaarli utilities */ +/** + * Logs a message to a text file + * + * @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); +} + /** * Returns the small hash of a string, using RFC 4648 base64url format *