theorchard / monolog-cascade

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

php config docs missing #48

Closed glensc closed 8 years ago

glensc commented 8 years ago

The readme says it supports YAML, JSON and PHP configs, but i can't find any example or documentation how the file should be formatted, should it return array and in what structure?

I end up instead with Illegal string offset error, similar to #41

glensc commented 8 years ago

reproducer: https://gist.github.com/glensc/d2a265723abb31df4257

gives now:

PHP Fatal error:  Uncaught exception 'Symfony\Component\Config\Exception\FileLoaderLoadException' with message 'Cannot load resource "/tmp/issue-48/config.php".' in /tmp/issue-48/vendor/symfony/config/Loader/DelegatingLoader.php:42
glensc commented 8 years ago

thanks @michaelmoussa, exactly what i'm looking for!

rantonmattei commented 8 years ago

I wish I had more time to polish this part cause it is a bit confusing indeed. the fileConfig function name is misleading. It may take an array.

$option = array(
    // you config array here
);
Cascade::fileConfig($options);

@michaelmoussa 's PR is a good alternative.

glensc commented 8 years ago

can you merge it? i then can base my changes on his code.

i can send you PR based on your https://github.com/theorchard/monolog-cascade/issues/48#issuecomment-185257606

rantonmattei commented 8 years ago

I merged #50