summaryrefslogtreecommitdiff
path: root/it.class
diff options
context:
space:
mode:
Diffstat (limited to 'it.class')
-rw-r--r--it.class10
1 files changed, 7 insertions, 3 deletions
diff --git a/it.class b/it.class
index 8159dd5..39a1372 100644
--- a/it.class
+++ b/it.class
@@ -70,14 +70,18 @@ static function &cloneobj(&$object)
/**
* Append all arguments to a logfile (tab separated). Date will be added to filename and line
* @param $name Name of logfile. Will be in log/ of service unless it starts with /
- * @param $line1 Line to append (varargs)
+ * @param $args... Varargs to log, will be tab separated. datetime => ... can be in first arg (dangerous)
*/
static function log($name /* ... */)
{
$args = func_get_args();
- $line = date("Y-m-d H:i:s") . "\t" . implode("\t", array_slice($args, 1)) . "\n";
+ $name = array_shift($args);
+ if (is_array($args[0]))
+ $p = array_shift($args);
+ $timestamp = $p['datetime'] ? strtotime($p['datetime']) : time();
+ $line = date("Y-m-d H:i:s", $timestamp) . "\t" . implode("\t", $args) . "\n";
$basefn = substr($name, 0, 1) == "/" ? $name : $GLOBALS['ULTRAHOME'] . "/log/$name";
- $fullfn = $basefn . "-" . date('Ymd');
+ $fullfn = $basefn . "-" . date('Ymd', $timestamp);
if (substr($fullfn, 0, 1) == "/")
{