-
Notifications
You must be signed in to change notification settings - Fork 444
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
Add support for Monolog 2.x #2302
Conversation
14e46f9
to
735cf37
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a factory class would be useful as well? LoggerFactory::getFormatter()
and LoggerFactory::getHandler()
, both detect which version of monolog is available and construct an implementation?
735cf37
to
7e24b7c
Compare
I thought about this as well, similar to the HttpHandlerFactory in |
Codecov Report
@@ Coverage Diff @@
## master #2302 +/- ##
============================================
- Coverage 92.6% 92.48% -0.12%
- Complexity 4467 4477 +10
============================================
Files 307 311 +4
Lines 13323 13352 +29
============================================
+ Hits 12338 12349 +11
- Misses 985 1003 +18
Continue to review full report at Codecov.
|
@jeromegamez yep! |
Just added an additional commit with the factory \o/ - I had to fix the lower version to ^1.1 because Monolog 1.0.* didn't have an autoloader 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @jeromegamez, appreciate the quick changes! A couple more things I see, and I'm also wondering whether the name format is ambiguous. AppEngineFlexV2Handler
seems to me that it could imply it's talking about App Engine Flex V2. Perhaps AppEngineFlexHandlerV2
would be better? What do you think?
Thank you @jdpedrie, I appreciate the fast responses! I made the changes and hope this looks better now. Once you are happy with the changes, I would like to squash the changes into a single commit, if you agree. |
I'm looking into the build failures right now, it seems I missed something in the other test suites. |
@jeromegamez it's not your fault, it's an issue with the parser we use to extract and test code snippets. Since it scans the entire project, it fails when it runs into the scalar type hints and return types (in PHP 5) and when those declarations are missing and the interface isn't properly fulfilled (in PHP 7.2+). Modify private static $snippetExcludeList = [
'/\\\GcTestListener/',
'/\\\Google\\\Cloud\\\Core\\\Logger/',
'/\\\Google\\\Cloud\\\Core\\\PhpArray/',
]; |
e191903
to
9a55804
Compare
Whew, I'm relieved 😌! I couldn't get it to work and was already running out of possible workarounds ^^ Thanks! |
Uh, I just realized that I totally misread your Factory proposal... shall I rewrite the factory again? |
No, I like how you did it. I don't believe there is generally a need to directly instantiate a formatter, so the single method for the handler is sufficient. As to the latest build failures, it's the same issue as the previous one, but related to the doc generator. I'll need to investigate workarounds a bit further. |
@jdpedrie I added something to the doc generator that hopefully can solve the problem - at least executing |
eb3d126
to
4f9a07e
Compare
The former is not available on Windows.
8209d9e
to
37de613
Compare
I had to update the PR again because I noticed that the class-to-file map in the CodeParser was incorrect - the V2 classes pointed to the V1 files 😓 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You, my friend, are awesome.
This is very well thought out and implemented, I can't thank you enough for taking the time to contribute 👏.
Thank you @dwsupplee, this makes me happy 🥰, and thank you @jdpedrie for the fruitful interaction, this was a lot of fun! |
Hey everyone 👋
This is a follow up to #2293 and aims to add support for both monolog/monolog 1.x and 2.x.
Monolog 2.x was released on August 30th, 2019 and requires PHP ^7.2 whereas google/cloud keeps supporting PHP 5.6.
The specific issue is that Monolog 2.x adds method return types which are not supported by PHP 5.x. On the other hand, leaving the return type declarations out causes PHP 7.x to throw errors.
AppEngineFlexHandler
andAppEngineFlexFormatter
remain the implementation for Monolog 1.x.AppEngineFlexV2Handler
andAppEngineFlexV2Formatter
are the new implementations for Monolog 2.x.The new classes are the same as the old ones with the only difference being added return type declarations.
Notes
~1
constraint.