Skip to content
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

convert argument fmt into dict if argument is a string #169

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

harish2704
Copy link

FluentRecordFormatter is expecting fmt to be either a callable or a dict. But there is no strict type checking is done to check whether the variable is dict or not.

There are many situations in which fmt can have a string value.
For eg: if logger is loading configuration from a config file using ConfigParser , then there is no way to specify a dict inside the config file.

This change is backward compatible from Python2.7 to Python3.8 since ast.literal_eval will work in same way since python 2.6+

FluentRecordFormatter is expecting fmt to be either a callable or a dict. But there is no strict type checking is done to check whether the variable is dict or not.

There are many situations in which `fmt` can have a string value.
For eg: if logger is loading configuration from a config file using [ConfigParser](https://docs.python.org/2/library/configparser.html) , then there is no way to specify a dict inside the config file.

This change is backward compatible from Python2.7 to Python3.8 since `ast.literal_eval` will work in same way since python 2.6+

Signed-off-by: Harish Karumuthil <[email protected]>
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.5%) to 99.462% when pulling f38ee21 on harish2704:master into d1b81ba on fluent:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants