function logs($str, $level = INFO) {
global $LOGLEVEL, $LOGFP, $argv;
- if ($str and $LOGLEVEL & $level) {
+ if ($str and ($LOGLEVEL & $level) == $level) {
fputs($LOGFP, sprintf("%s %s[%d] %-8s %s\n", strftime('%c'),
basename($argv[0]), getmypid(), loglevel2str($level), $str));
}