mirror of
https://github.com/zhamao-robot/zhamao-logger.git
synced 2026-07-02 14:25:40 +08:00
fix: remove @ error suppression from echo/fwrite/fflush calls
`@echo` is invalid PHP syntax — echo is a language construct, not a function, so the @ operator cannot be applied to it. This causes a parse error on some PHP versions/runtimes. The recursion guard ($in_log) added in 1.1.7 already prevents infinite loops when STDOUT/STDERR is broken, so @ suppression is unnecessary. Remove @ from echo, fwrite, and fflush calls. Version bumped from 1.1.8 to 1.1.9.
This commit is contained in:
@@ -10,7 +10,7 @@ use Psr\Log\LogLevel;
|
||||
|
||||
class ConsoleLogger extends AbstractLogger
|
||||
{
|
||||
public const VERSION = '1.1.8';
|
||||
public const VERSION = '1.1.9';
|
||||
|
||||
/**
|
||||
* 日志输出格式
|
||||
@@ -258,14 +258,14 @@ class ConsoleLogger extends AbstractLogger
|
||||
try {
|
||||
// use stream
|
||||
if ($this->stream) {
|
||||
@fwrite($this->stream, $output);
|
||||
@fflush($this->stream);
|
||||
fwrite($this->stream, $output);
|
||||
fflush($this->stream);
|
||||
} else {
|
||||
if ($level <= 4 && $this->use_stderr) {
|
||||
@fwrite(STDERR, $output);
|
||||
fwrite(STDERR, $output);
|
||||
} else {
|
||||
// use plain text output
|
||||
@echo $output;
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user