1 <?php // vim: set binary noeol et sw=4 sts=4:
3 function logserr($str, $level = L_ERR) {
5 logs("$str ($php_errormsg)", $level);
8 function logs($str, $level = L_INF) {
9 global $LOGLEVEL, $LOGFP, $argv;
10 if ($str and $LOGLEVEL & $level) {
11 fputs($LOGFP, sprintf("%s %s[%d] %-8s %s\n", strftime('%c'),
12 basename($argv[0]), getmypid(), loglevel2str($level), $str));
16 function loglevel2str($level) {
33 if (count($ret) == 1) {
37 return '['.join(',', $ret).']';