Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogLevel 枚举有错误 #24

Closed
crazywhalecc opened this issue Dec 28, 2021 · 4 comments · Fixed by #25
Closed

LogLevel 枚举有错误 #24

crazywhalecc opened this issue Dec 28, 2021 · 4 comments · Fixed by #25
Assignees
Labels
area/function 关于功能 kind/bug 这是个BUG lifecycle/stale 来自古老的时代

Comments

@crazywhalecc
Copy link
Member

受影响版本

0.3.0

描述

Psr\Log\LogLevel 中,LogLevel::INFO 获取到的是字符串 info,而在 libob 内,应该让 ConsoleLogger::$logLevel 为数字,目前因为这个问题无法正确使用 logger。

复现步骤

使用 demo.php,无法显示 info log。

解决方案

修改 ConsoleLogger。(具体我也不知道 Psr 的要求是什么,我也去看看。

附加信息

image
image

@sunxyw
Copy link
Collaborator

sunxyw commented Dec 29, 2021

ConsoleLogger 本身并无问题,在 demo.php 内使用 $ob->getLogger()->info('foo bar'); 可以正常输出 INFO 日志。
圖片

下方的 Workerman 日志由 Workerman 自身输出,见源码:
displayUI方法
safeEcho方法

粗略来看,似乎无法从外部干预,是否有办法截获 / 修改 Workerman 的输出流?

@sunxyw sunxyw added the blocked/require-more-info 需要更多信息 label Dec 29, 2021
@crazywhalecc
Copy link
Member Author

if (array_flip(self::$levels)[$level] > self::$logLevel) {

在这个位置使用了运算符比较级别大小,但是此处的 $logLevel 可追溯到前面是字符串 info,应该是这里出现了问题,与 Workerman 无关。

Workerman 的输出先留在那,后面我会去掉并自定义格式化(因为 Swoole 那边啥输出也没有)。

@crazywhalecc
Copy link
Member Author

Workerman 按 Ctrl+C 的那个提示确实不好弄,不过 Workerman 应该都能重写。

sunxyw added a commit that referenced this issue Dec 29, 2021
@sunxyw sunxyw linked a pull request Dec 29, 2021 that will close this issue
@crazywhalecc crazywhalecc removed the blocked/require-more-info 需要更多信息 label Dec 29, 2021
@github-actions
Copy link

github-actions bot commented Jan 6, 2022

由于在关闭后没有更多信息,此Issue已被自动锁定。如有需要请提出一个新Issue。

@github-actions github-actions bot added the lifecycle/stale 来自古老的时代 label Jan 6, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/function 关于功能 kind/bug 这是个BUG lifecycle/stale 来自古老的时代
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants