diff options
author | VirtualTam <virtualtam@flibidi.net> | 2016-01-16 16:10:14 +0100 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2016-01-16 16:10:14 +0100 |
commit | 73151d95469b6aee727f3c1f55c07bb91346f9d3 (patch) | |
tree | bbd00b908dcfc329eea37ac32839f63044ceec3d /application | |
parent | 92ba7b573f2833bd35c7eb2fc7fdbeb1a0ac7b44 (diff) | |
parent | 1abe655597da7b3c5b59146c4351eef59f69514c (diff) | |
download | Shaarli-73151d95469b6aee727f3c1f55c07bb91346f9d3.tar.gz Shaarli-73151d95469b6aee727f3c1f55c07bb91346f9d3.tar.zst Shaarli-73151d95469b6aee727f3c1f55c07bb91346f9d3.zip |
Merge pull request #437 from virtualtam/refactor/utils/logm
Logging: move logm() from index.php to application/Utils.php
Diffstat (limited to 'application')
-rw-r--r-- | application/Utils.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/application/Utils.php b/application/Utils.php index aeaef9ff..a9a10ece 100644 --- a/application/Utils.php +++ b/application/Utils.php | |||
@@ -4,6 +4,19 @@ | |||
4 | */ | 4 | */ |
5 | 5 | ||
6 | /** | 6 | /** |
7 | * Logs a message to a text file | ||
8 | * | ||
9 | * @param string $logFile where to write the logs | ||
10 | * @param string $clientIp the client's remote IPv4/IPv6 address | ||
11 | * @param string $message the message to log | ||
12 | */ | ||
13 | function logm($logFile, $clientIp, $message) | ||
14 | { | ||
15 | $line = strval(date('Y/m/d_H:i:s')).' - '.$clientIp.' - '.strval($message).'\n'; | ||
16 | file_put_contents($logFile, $line, FILE_APPEND); | ||
17 | } | ||
18 | |||
19 | /** | ||
7 | * Returns the small hash of a string, using RFC 4648 base64url format | 20 | * Returns the small hash of a string, using RFC 4648 base64url format |
8 | * | 21 | * |
9 | * Small hashes: | 22 | * Small hashes: |