ordersprinter/webapp/php/utilities/Logger.php

32 lines
712 B
PHP
Raw Permalink Normal View History

2020-11-19 22:47:44 +01:00
<?php
class Logger {
public static function logcmd($module,$cmd,$msg) {
if (LOG) {
$logtimestamp = date("d.m.Y-") . date("H:i:s");
$ip=getenv("REMOTE_ADDR");
$dateiname = "/is/htdocs/user_tmp/wp12426429_6ZLSFXBWHG" . "/ordersprinter.log";
$gets = "";
foreach($_GET as $key => $value)
{
if (($key != "command") && ($key != "module")) {
$gets .= "$key=$value ";
}
}
if ($msg != null) {
$msg = " -- " . $msg . " -- ";
}
$logMsg="$ip - - [$logtimestamp]: " . str_pad($module,15) . " -- " . $cmd . $msg;
if ($gets != "") {
$logMsg .= " -- GET: $gets";
}
$datei=fopen($dateiname,"a");
fputs($datei,"$logMsg\n");
fclose($datei);
}
}
}
?>