-
Notifications
You must be signed in to change notification settings - Fork 159
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
feat(BA-593): Configure the logging module's config file to use Pydantic #2834
base: main
Are you sure you want to change the base?
Conversation
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.
- Let's use Pydantic's alias generator to accept hyphenated field names as well.
- Let's avoid using
Annotated
whenever possible to reduce verbosity.
class HostPortPair(BaseSchema): | ||
host: str = Field(examples=["127.0.0.1"]) | ||
port: int = Field(gt=0, lt=65536, examples=[8201]) | ||
|
||
def __repr__(self) -> str: | ||
return f"{self.host}:{self.port}" | ||
|
||
def __str__(self) -> str: | ||
return self.__repr__() | ||
|
||
def __getitem__(self, *args) -> int | str: | ||
if args[0] == 0: | ||
return self.host | ||
elif args[0] == 1: | ||
return self.port | ||
else: | ||
raise KeyError(*args) |
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.
One thing I’m wondering is why the HostPortPair
class is inside the logging
package.
It seems like it should be in a different package.
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.
We support several logging tools and may support more in the future.
(ex, graylog, logstash)
Since these logging tools require the host address by default, we've just separated that part into a common setting.
ref.
t.Key("host"): t.String, |
Please resolve the conflict. @Yaminyam |
resolve #3518 (BA-593)
Ensure that the logging module's config file is validated using pydantic.
Make logging module-specific settings that wsproxy implements in its own config file common to the logging module.
If you are working on replacing trafaret with pydantic and you have resolved any dependencies on the logging module, you can replace
config_pydantic.py
withconfig.py
Checklist: (if applicable)