Skip to content

pretty-printy Log Dictionary option #5082

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

Open
oboehmer opened this issue Mar 15, 2024 · 2 comments
Open

pretty-printy Log Dictionary option #5082

oboehmer opened this issue Mar 15, 2024 · 2 comments

Comments

@oboehmer
Copy link
Contributor

It would be good to have an option to pretty-print dictionaries, i.e. with indentation in the logs for better examination. Robot already pretty-prints dict return values in the log (when using TRACE option), so suggest to offer this also when doing it from keyword (maybe with an indent=<int> option which would then just do a json.dumps(dict, indent=indent) if set.

Happy to provide a PR to do this in 7.1

@oboehmer oboehmer changed the title prett-printy Log Dictionary option pretty-printy Log Dictionary option Mar 15, 2024
@JFoederer
Copy link
Contributor

Doesn't the formatter=repr option from the BuiltIn Log keyword already provide the requested feature?

When using repr, bigger lists, dictionaries and other containers are also pretty-printed so that there is one item per row. For more details see String representations.

@pekkaklarck
Copy link
Member

Yeah, formatter=repr with the Log keyword ought to handle this. Log Dictionary also automatically logs items like:

key1: value1
key2: value2

I'm sure we could still enhance this, though. Is there something concrete you @oboehmer had in mind?

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

No branches or pull requests

3 participants