-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
KERNEL: Refine logger and error #913
Comments
We use variable For some error in underlayer, for example, for daemon to fork processes, we can just use error without logger:
Replace the old logger+error:
That's the point. After refined, the error is a single event to log:
For each call function, use
That's right~ |
Here we confused the log and error:
Instead, we should return a error:
Finally at the top of call, such as the thread cycle or main cycle, we can decide whether to print the error or not. |
Fixed. |
The logger should only log the "BIG" events, which are not error. In addition, logger should support context. The errors should, not only the error code, but indicates the context such as the stack and description. For detail information about errors, please read https://gocn.io/article/348.
For SRS, it confuses the error and logger, that is SRS output error in logger and in each function calls. There is a example, when error cames from
SrsSource::on_video_imp
, each function will print a error:Let's have a look what happends when there is a decode error:
Is it useful? Yes, it's useful than just an error code like
Failed, code is 3001
, but it's not enough:I'll be better if the error is like this:
For logger, it should log some important events, the error should be one event.
The text was updated successfully, but these errors were encountered: