nvanheuverzwijn / monolog-logdna

GNU Lesser General Public License v3.0
21 stars 21 forks source link

Allow set Logdna tags on handler #12

Closed slepic closed 10 months ago

slepic commented 10 months ago

This PR allows to set Logdna tags on the monolog handler like this

$handler = new LogdnaHandler($key, $host);
$handler->setTags($tags);

The way the query params are generated is also slightly improved from sprintf to http_build_query+array_filter, since the tags can be anything it should be at least urlencode()'d which is handled by http_build_query. The array_filter could potentialy remove "0"'s but i don't think that was ever a valid input for the other params so it should not break anything, but ultimately it may not be necesary, but sending empty params isnt necesary either, so i included it for now, but i can remove it if you want.