Closed dmnc closed 9 years ago
Yes, you are absolutely right. There are still a few things missing. What you are mentioning is part of it.
I referenced that in a blog post I wrote. https://medium.com/orchard-technology/enhancing-monolog-699efff1051d (See Limitations section). I should probably add that to the ReadMe as well cause it impacts a bunch of handlers.
I haven't given it too much thoughts yet but feel free to take a stab at it and submit a PR.
The main challenge here is to be able to translate a statement like
new Raven_Client($someArg, $anotherArg, ...);
into something much simpler like a Yaml syntax and to have it flexible enough so it does support instantiating any classes passing a bunch of args.
Something along
handlers:
raven_handler:
class: Monolog\Handler\RavenHandler
raven_client:
class: Raven_Client
options_or_dsn: "xxx"
level: WARNING
would be ideal and would allow to reuse the class loader. It would require adding more recursion to the parsing. (=> This is just a quick thought.)
For now the only workaround I see is to use a Php array as your config. I haven't tried though, but it might work.
I'll leave this issue open in case someone wants to take a stab at it.
I might be missing something here, but I don't seem to be able to use the closure system on constructor arguments, only on setters.
This seems to indicate that for something like the RavenHandler where I need to pass a Raven_Client I am pretty stuck.
It looks like the RedisHandler would have the same problem.