spatie / laravel-ray

Debug with Ray to fix problems faster in Laravel apps
https://myray.app
MIT License
291 stars 64 forks source link

Fix handling of null logs #171

Closed sinnbeck closed 3 years ago

sinnbeck commented 3 years ago

When logging, you can by accident log null. This will throw an exception in laravel-ray as it expects the message to be a string.

patinthehat commented 3 years ago

@sinnbeck Wouldn't a check to make sure the message is a string be a better choice instead of just checking for null?

After taking a peek at the Laravel source, it looks like the message has no type, so it could be anything, in theory.

sinnbeck commented 3 years ago

@patinthehat I think laravel converts it to a string under the hood. I can do Log::info(['foo' => 'bar']); and it works just fine. I can only get it to fail if I send in null

patinthehat commented 3 years ago

Absolutely, you're right. :+1:

freekmurze commented 3 years ago

Thanks! I appreciate the added test.