if we're already using stdout for something else, don't log to stdout

This commit is contained in:
Shish 2023-02-16 20:28:27 +00:00
parent 743f4d8b5a
commit 0f69c9de45

View file

@ -30,6 +30,7 @@ class LogConsole extends Extension
));
}
/*
if ($event->page_matches("log_test")) {
log_debug("log_console", "Hello debug!");
log_info("log_console", "Hello info!");
@ -37,6 +38,7 @@ class LogConsole extends Extension
$page->set_mode(PageMode::DATA);
$page->set_data("You should see something in the log\n");
}
*/
}
public function onLog(LogEvent $event)
@ -78,8 +80,10 @@ class LogConsole extends Extension
} else {
$str = "$str\n";
}
$fp = fopen("/dev/tty", "w");
fwrite($fp, $str);
fclose($fp);
if (!defined("UNITTEST") && PHP_SAPI !== 'cli' || PHP_SAPI !== 'phpdbg') {
$fp = fopen("/dev/tty", "w");
fwrite($fp, $str);
fclose($fp);
}
}
}