-
Notifications
You must be signed in to change notification settings - Fork 1
"Type safety" #21
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
"Type safety" #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just wonder if we will end up 'losing' these logs which go to error_log
.
What would you think about re-packaging the malformed arguments and flagging them with something like malformed: true
so we could detect them?
For example, if the arguments don't satisfy the conditions in checkLogParametersType()
we could instead call BuffLog with something like BuffLog::warning('Malformed BuffLog request', ['malformed' = true, 'args' => $args]);
We would need to be careful of not creating an infinite loop, admittedly! 😅
@colinscape fantastic idea, I like it. and with that we could also monitor how engineers don't use the library correctly . |
echo json_encode([ | ||
"message" => "Can't find \DDTrace\GlobalTracer class. Did you install the Datadog APM tracer extension? It will allow you to have logs enriched with traces making troubleshooting easier. If you run a cli mode service (such as a worker), did you set the DD_TRACE_CLI_ENABLED env variable?", | ||
"level" => 300, | ||
"level_name" => "WARNING", | ||
"context" => ["bufflog_error" => "no_tracer"] | ||
]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the logger isn't ready yet, we have to do this manually
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good @erickhun - I left a couple more thoughts for improvements/enhancements that you could potentially consider. 😀
We got few incidents when passing the wrong type of parameters. Since it makes the PHP erroring out and make a full service stop, I simply output an error message instead of stopping the script execution.
I was thinking to use the type-hint but since we use the magic function
call_user_func_array
i'm not too sure how to do it altogether.@colinscape up for a review?