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

Refactor logging control, adding logLevel option #215

Merged
merged 3 commits into from
Dec 20, 2020
Merged

Refactor logging control, adding logLevel option #215

merged 3 commits into from
Dec 20, 2020

Conversation

eemeli
Copy link
Owner

@eemeli eemeli commented Dec 20, 2020

Make the logging controllable via a new option:

logLevel: 'silent' | 'error' | 'warn' | 'debug'

The default is 'warn', and acts pretty much as previously. At least for now 'debug' doesn't add anything on top of it.

Setting logLevel: 'error' silences warnings during YAML.parse() and doc.toJS().

Setting logLevel: 'silent' also does its best to silence even parsing errors, resulting in output that should represent at least a part of the original input, even if it isn't entirely valid YAML.

As a related change, the warning about casting collections to string when used a map key & mapAsMap is not enabled is now emitted only during the toJS() call, rather than being added to the doc.warnings array.

@eemeli eemeli added the enhancement New feature or request label Dec 20, 2020
@eemeli eemeli merged commit 42d065b into master Dec 20, 2020
@eemeli eemeli deleted the loglevel branch December 20, 2020 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant