theorchard / monolog-cascade

Configure multiple loggers and handlers in the blink of an eye
MIT License
145 stars 62 forks source link

Added option resolvers for Constructor params and additional options #9

Closed rantonmattei closed 9 years ago

rantonmattei commented 9 years ago

2 resolver classes, they both use a reflected object (see Reflection)

Those 2 essentially do the same thing:

  1. define valid options from a given class
  2. validate them against passed in params (see theresolve method)

Constructor params are must have, you need those to instantiate a logger handler (StreamHandler for instance). Extra params is a way to consume more params for the config if needed. Let's say you want to use a handler but not all the params you want to use can be passed through the constructor LogglyHandler for instance. It takes only the token and the level... but let's say you'd like configure tags as well. The way you would typically do it is instantiate your handler first and then call either the setTag or addTag method.

Cascade allows you to do this automatically by passing add_tag as a param so everything is configured in one step

@mortaliorchard @OrCharles

rantonmattei commented 9 years ago

ClassLoader is missing. The test cannot mock that class. It is used as a DI. Will add it in a few...

OrCharles commented 9 years ago

ah, makes sense.. I was wondering what $classLoader->canHandle(.. was doing

mortaliorchard commented 9 years ago

This is quite simple – and clean. No major feedback here. R+

OrCharles commented 9 years ago

R+ once the build passes