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

[BUG] - Keep indentation on multiline properties #23

Closed
matdurand opened this issue Dec 5, 2023 · 3 comments
Closed

[BUG] - Keep indentation on multiline properties #23

matdurand opened this issue Dec 5, 2023 · 3 comments

Comments

@matdurand
Copy link

matdurand commented Dec 5, 2023

Describe the bug
Maybe in between a bug and a feature request, but when an attribute has a value with "\n", the result is hard to read.

To Reproduce
Steps to reproduce the behavior:

Here is an example:
This code:

logger.Info("dummy log", "attr1", "this is a long string\non multiple lines.\nit would read better if we kept indentation")

generates this log entry

[14:55:36]  INFO  dummy log
  attr1: this is a long string
on multiple lines.
it would read better if we kept indentation

Expected behavior
Ideally we should see:

[14:55:36]  INFO  dummy log
  attr1: this is a long string
         on multiple lines.
         it would read better if we kept indentation

or at the very least

[14:55:36]  INFO  dummy log
  attr1: this is a long string
  on multiple lines.
  it would read better if we kept indentation
@david-littlefarmer
Copy link
Collaborator

I created PR with this feature #24, please try it and let me know.
go get github.com/golang-cz/devslog@string_indent
I am not sure if it's ok to modify logged string, but at this point, i think it doesn't matter.

@matdurand
Copy link
Author

The PR works fine. Thanks!

I am not sure if it's ok to modify logged string, but at this point, i think it doesn't matter.

Maybe you could make it an config option?

@david-littlefarmer
Copy link
Collaborator

I added option StringIndentation for Config. PR is merged to 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

No branches or pull requests

2 participants