-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.0 Code cleanups / tasks #197
Comments
you should define |
yup for sure, though that won't entirely prevent the need for a check, |
Since we're talking about breaking BC anyway ... I've always wondered why in
That way you only check once if a hander will handle a message, and then and only then give it the record. With the current version of the code all handlers need to call |
There are a few things that influenced the existing code:
Since bubbling is rarely disabled and processors are also not very much used it seems, maybe one thing we could do at least is avoid calling isHandling if no processors are present. That would be BC and might make things a wee bit more efficient. |
I think the "FingersCrossedHandler" has a bad name. I was looking something like "Backtrace" logger and just wanted to start to implement that for myself and then I have found the FindersCrossedHandler" in the docs. I would appreciate to rename this handler to a more obvious name for those who first look into the source code and file names. |
@DennisBecker I feel your pain but frankly I doubt there is a short name that can convey clearly what it does to everyone. It's just a concept and as such Backtrace wouldn't be more clear to me and less fun so I'd say no. It's not strictly a backtrace since it also sends logs following an error for example. |
@Seldaek I agree, backtrace doesn't fit better at all. It is more a kind of log message aggregation. That would better describe it from my point of view. |
One thing that may be worth considering is the potential to limit the handlers contributed to the core library, and instead encourage contributions as a separate library. Just something to consider. |
@adlawson I'm generally all for pushing code into plugins, because I don't particularly enjoy having to maintain code I am not using and did not write. That said, in this case since most handlers have very little code it's not so bad on the maintenance side, and having them "blessed" here means higher code quality and consistency between handlers. At least I try to keep things that way, probably it's not 100%, but better than if there was a wild-west of plugin packages to choose from I think. So that's unlikely to change unless the amount of log backends becomes unmanageable. |
Maybe a better name for FingersCrossedHandler would be AllOrNothingHandler? It does convey what the handler does a little bit better. Although I personally still think FingersCrossedHandler is the best class name ever and does not need changing I can see that it can be confusing to newcomers. |
@Seldaek some LogHandlers have a plethora of parameters which make them really hard to use and read. |
@staabm might be enough to have a simple $options array as standard constructor param.. Not as self-documenting as the args but I agree in some cases it's getting a bit absurd. |
@DennisBecker +1 For "FingersCrossedHandler" having a bad name. I wasted a couple hours building and testing my own handler which had the same functionality. I don't like my name for it either, but I named mine "TailingBufferHandler" because what I wanted to see from it was kind of like a linux "FingersCrossed" sounds like a goofy ass database name, or the name of some quirky log service you've never heard of -- and that makes it extremely easy to overlook. Which is a shame, because it's awesome! Quite possibly the most useful handler. |
Do you have a branch where you're targeting these changes to? I'd be willing to lend a hand on some of the low complexity ones like removing todos, and moving the |
Just a small side note on the naming FingersCrossed: The concept is close to tripping a fuse, a common pattern in flood avoidance code. BufferedFuse? FuseTripping? I'm not saying these are good, but maybe will inspire someone for a better one. Good naming will save a lot of time for many I think, just judging from how many already said here that they essentially started implementing it on their own as well. |
"Drop support for outdated mongo exts in MongoDBHandler" can be marked as done via #307. Very Minor PHP 7 Ideas:
|
Why was "Split handlers w/ dependencies into packages" crossed out? It seems like a good idea to me. At the moment if you want to develop for monolog and run all the tests to make sure you haven't broken anything you need to install a lot of dependencies, one of which I don't even have access to at all (Zend Server). If parts that need additional dependencies were to be split off of the main repository it would make developing a lot easier imo. |
@ZergMark return types are used in several places already. |
Potentially related to this and #903: a number of handlers are using the curl extension directly in conjunction with
Support for environments without the curl extension could be possible by refactoring these handlers to use Guzzle instead. |
Instead of going for Guzzle I would consider HTTPlug instead so people can provide their own implementation. |
I'd like to chime in on the old topic of |
What will be different between Monolog 1 and 2? Will existing code still work? |
The point of a new major version is mostly that it will break „some“ things, hopefully not too much |
Yeah the goal is to keep things working for end users apart from the configuration of the logger (which is mostly abstracted in other places/frameworks anyway). You can see https://github.com/Seldaek/monolog/blob/master/UPGRADE.md for the current listed BC breaks, the first two kinda affect regular usage. |
What will be minimal PHP version? Bacause some systems like Ubuntu 14.04 and 16.04 don't have latest PHP version (7.2) in repositories. Also, many hosting are still using PHP 5.5. |
@filips123 For now, it requires PHP 7.1+ |
and if you still need to support PHP 5.5, the solution is simple: keep using Monolog 1.x. It won't magically stop working the day 2.0 is released. |
Clean up arg orders of handlers that have had added args pushed at the end (after bubbling etc), maybe group them in an $options array or parameter objects? Needs RFC. Check Add fluent setters for parameters in the slack handler #801 too about fluent settersfigure out how to handle network timeouts globally somehow, see Allow custom connection_timeout to LogEntries handler #733Monolog\TestCase
to src/, see Create PEAR System_Daemon handler #356 (comment)Split handlers w/ dependencies into packages i.e. http://php-and-symfony.matthiasnoback.nl/2014/04/theres-no-such-thing-as-an-optional-dependency/Change Logger constants to have RFC values (https://github.com/php-fig/log/issues/8)$this->pushHandler(new StreamHandler('php://stderr', static::DEBUG));
) from Monolog\LoggerConsider adding a public method (send or write or so) on handlers to make reusing them out of monolog easier, c.f.f3b61cf#commitcomment-8237858room_id
andfrom
in buildContent (+nickname
everywhere) should be removed. See if we can't detect the token format and warn users using a v1 token.php7 ideas:
possibly remove ErrorHandler::registerFatalHandler if this is not needed anymorethose items have been abandonedThe text was updated successfully, but these errors were encountered: