Conversation
There was a problem hiding this comment.
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.
because the logger isn't ready yet, we have to do this manually
colinscape
left a comment
There was a problem hiding this comment.
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_arrayi'm not too sure how to do it altogether.@colinscape up for a review?