-
Notifications
You must be signed in to change notification settings - Fork 284
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
throw exception when parameters object is null #58
Comments
@vanjor What exactly is your point? The call is quite clear, it must take an array... Whether or not that functionality should be expanded to include other types of context, is a valid discussion in my opinion but you don't raise such point. Adding null as a context won't add anything to your logfile and no matter what type of context we would allow, it would always look kinda odd. |
Agreed w/ @onno-vos-dev If you've got a concrete idea of what/how you think it should work, submit a PR and we'll have a look over. |
(Sorry to comment on a closed Issue @katzgrau ) Just to add to this: If we would like to include other forms of context, it would automatically mean we would deviate from the PSR-3 LoggerInterface as that only allows for $context to be of type array. Again, whether or not this is the best solution, I think is worth thinking about but breaking the LoggerInterface in favor of KLogger does not sound like a great idea to me. My final $0,02: $logger->log(LogLevel::DEBUG, 'Your request failed. The request you sent was: '.json_encode($request_data)); |
Thanks to both. Actually I does not expect logging function raise the exception, for PHP is a weak type as many function expected to return array, but return null at some case. accept @onno-vos-dev suggest,though this substituted way is a little bit verbos:) |
Argument 2 passed to Psr\Log\AbstractLogger::info() must be of the type array, null given
when calling $logger->info("raise the log", null);
The text was updated successfully, but these errors were encountered: