mirror of
https://github.com/zhamao-robot/zhamao-logger.git
synced 2026-03-17 20:44:52 +08:00
Enhance output handling in ConsoleLogger to use STDERR for specific log levels
This commit is contained in:
parent
b28c0c26d5
commit
e75fa01ca5
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "zhamao/logger",
|
||||
"description": "Another Console Logger for CLI Applications",
|
||||
"description": "Another Colorful Console Logger for CLI Applications",
|
||||
"type": "library",
|
||||
"license": "Apache-2.0",
|
||||
"autoload": {
|
||||
@ -16,7 +16,7 @@
|
||||
"authors": [
|
||||
{
|
||||
"name": "jerry",
|
||||
"email": "admin@zhamao.me"
|
||||
"email": "github@cwcc.me"
|
||||
},
|
||||
{
|
||||
"name": "sunxyw",
|
||||
|
||||
@ -242,11 +242,15 @@ class ConsoleLogger extends AbstractLogger
|
||||
if ($this->stream) {
|
||||
fwrite($this->stream, $output);
|
||||
fflush($this->stream);
|
||||
} else {
|
||||
if ($level <= 4 && $this->use_stderr) {
|
||||
fwrite(STDERR, $output);
|
||||
} else {
|
||||
// use plain text output
|
||||
echo $output;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换日志等级
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user