diff options
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -75,7 +75,17 @@ static function &cloneobj(&$object) static function log($name /* ... */) { $args = func_get_args(); - $line = date("Y-m-d H:i:s") . "\t" . implode("\t", array_slice($args, 1)) . "\n"; + $line = date("Y-m-d H:i:s") . "\t" . implode("\t", array_slice($args, 1)); + self::log_line($name, $line); + return $line; +} + +/** + * Append line to a logfile. Date will be added to filename + * @param $name Name of logfile. Will be in log/ of service unless it starts with / + * @param $line Line to log. + */ +static function log_line($name, $line) { $basefn = substr($name, 0, 1) == "/" ? $name : $GLOBALS['ULTRAHOME'] . "/log/$name"; $fullfn = $basefn . "-" . date('Ymd'); @@ -93,10 +103,8 @@ static function log($name /* ... */) @symlink($fullfn, $basefn); } - file_put_contents($fullfn, $line, FILE_APPEND); + file_put_contents($fullfn, $line . "\n", FILE_APPEND); } - - return $line; } |