oscarotero / psr7-middlewares

[DEPRECATED] Collection of PSR-7 middlewares
MIT License
668 stars 56 forks source link

Allow using native debug logging in CORS middleware #61

Closed delolmo closed 7 years ago

delolmo commented 7 years ago

neomerx/cors-psr7 supports debug mode with a PSR-3 Logger Interface. The proposed changes allow passing such a logger to the object constructor so that logging can take place.

oscarotero commented 7 years ago

Hey, thank you. Good addition, but I think this option should be passed using a method, instead using the constructor. The general rule is: constructors only accept the most important argument of the middleware: the router instance, whoops instance, cors settings instance, etc. The other optional settings are passed through methods. So I'd do something like this:

$middleware[] = Middleware::cors($settings)
    ->logger($logger);

What do you think? Do you mind make this change?

delolmo commented 7 years ago

Done!

oscarotero commented 7 years ago

Good job! Thank you