-
-
Notifications
You must be signed in to change notification settings - Fork 239
Deprecate "mongo" handler type in favor of new "mongodb" syntax #550
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
Conversation
dcfe73f to
a073d14
Compare
|
The Fabbot failure seems unrelated:
None of the new test methods introduced in this PR specify a return type. |
|
|
||
| if (empty($handler['formatter'])) { | ||
| $formatter = new Definition('Monolog\Formatter\MongoDBFormatter'); | ||
| $formatter->setPublic(false); |
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.
It's an inline service, it can't be public, you can remove this statement.
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.
I saw that Definition has private bool $public = false. I assume most of these setPublic(false) calls throughout MonologExtension are just obsolete.
We added the rule after. We should probably remove the return type in this branch. It's annoying to ignore fabbot failures. Edit: you can rebase. |
a271f81 to
899c151
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.
A few ideas if you want to refine it, but otherwise it looks good to me!
|
|
||
| $client = new Definition('MongoDB\Client', [ | ||
| $handler['mongodb']['uri'], | ||
| $uriOptions, |
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.
Should we have writeConcern: 0 or 1 by default for logs?
You can accept driver options.
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.
That can be specified in the uri option. I only wanted to break out username and password since (a) they might come from separate env vars and (b) they were supported in the original mongo syntax and I wanted to avoid dealing with URI encoding.
We can revisit when adding more options across the board.
You can accept driver options
Were you actually referring to $driverOptions (i.e. third ctor param) or just URI options?
|
For the error in the CI, we can add |
13822f1 to
44acdc5
Compare
5e9ddf7 to
eb52914
Compare
Define a new "mongodb" handler type. It accepts an "id" reference like the old "mongo" type; however, "uri" instead of a single "host" and "port". The "uri" option is more flexible.
Additionally, the "username" and "password" options have been renamed and are no longer used to modify the connection string directly ("mongo" never applied URL encoding). Instead, the options are set in the URI options array, which does not require encoding. The "mongodb" never requires a password, as a username alone is valid for some auth mechanisms.
Lastly, a "monolog-bundle" app name is specified when the bundle constructs a MongoDB\Client instance for both "mongo" and "mongodb" handler syntax.
Apply MongoDBFormatter to each "mongodb" handler by default
Remove redundant Definition::setPublic() calls for inline services
Revise error messages for mongo and mongodb handler configs
Throw if mongodb/mongodb package is not available when configuring handlers
Add mongodb extension for CI testing
Skip tests if mongodb/mongodb is not installed
Add CI job for testing MongoDB handlers
eb52914 to
c1899dd
Compare
|
Thank you @jmikola. |
This PR was merged into the 4.x branch. Discussion ---------- Remove "mongo" handler type | Q | A | ------------- | --- | Branch? | 4.x | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | After #550 | License | MIT The `mongo` handler type is replaced by `mongodb`. Commits ------- 271d38a Remove "mongo" handler type
Define a new "mongodb" handler type. It accepts an "id" reference like the old "mongo" type; however, "uri" instead of a single "host" and "port". The "uri" option is more flexible.
Additionally, the "username" and "password" options have been renamed and are no longer used to modify the connection string directly ("mongo" never applied URL encoding). Instead, the options are set in the URI options array, which does not require encoding. The "mongodb" never requires a password, as a username alone is valid for some auth mechanisms.
Lastly, a "monolog-bundle" app name is specified when the bundle constructs a MongoDB\Client instance for both "mongo" and "mongodb" handler syntax.