1 <?php // vim: set binary noeol et sw=4 sts=4:
3 require_once 'T/logconstants.php';
5 function logserr($str, $level = ERROR) {
7 logs("$str ($php_errormsg)", $level);
10 function logsdie($str, $level = CRITICAL) {
15 function logs($str, $level = INFO) {
16 global $LOGLEVEL, $LOGFP, $argv;
17 if ($str and ($LOGLEVEL & $level) == $level) {
18 fputs($LOGFP, sprintf("%s %s[%d] %-8s %s\n", strftime('%c'),
19 basename($argv[0]), getmypid(), loglevel2str($level), $str));
23 function loglevel2str($level) {
24 if ($level == CRITICAL) {
27 if ($level == ERROR) {
30 if ($level == WARNING) {
36 if ($level == DEBUG) {