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

Inconsistent indentation of long log statements #1157

Open
joca-bt opened this issue Sep 11, 2024 · 3 comments
Open

Inconsistent indentation of long log statements #1157

joca-bt opened this issue Sep 11, 2024 · 3 comments

Comments

@joca-bt
Copy link

joca-bt commented Sep 11, 2024

There seems to be an inconsistency in how long log statements are indented when they break across lines. See the example below. If there's a line break, I'd expect the output to be like the first snippet.

class Test {
  void test() {
    logger.atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo()
        .log(
            "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");

    logger.atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo().atInfo()
        .atInfo().log(
        "123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890");
  }
}
@cushon
Copy link
Collaborator

cushon commented Sep 11, 2024

Thanks for the report, I agree this is surprising.

There are some heuristics for formatting Flogger-style fluent log statements, and usually everything up to .log( fits on a single line.

There's a related internal bug b/112194879 where something similar happens with a long .withCause(...) call.

@joca-bt
Copy link
Author

joca-bt commented Sep 12, 2024

I was trying to reproduce this with a regular dot with prefix but no luck so far, only with logs.

@cushon
Copy link
Collaborator

cushon commented Sep 12, 2024

I think that's expected, there's a very special case for formatting of log methods:

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