Skip to content

Inconsistent newline handling in debugLogger.Logf #828

Description

@sean-

debuggingLogger.Logf (opensearchtransport/logger.go:434) uses raw fmt.Fprintf without appending a trailing newline. This pushes newline responsibility onto every caller, and the convention is already inconsistent:
74 of 76 call sites include \n, while two in policy_chain.go (lines 176 and 203) do not.

The standard library's log.Printf appends a newline when the format string does not end with one. Our Logf should do the same.

Proposed fix

  1. Append \n in Logf when format does not already end with one (matching log.Printf semantics).
  2. Strip the trailing \n from all 74 call sites that currently include it.
  3. No change needed for the two policy_chain.go callers that already omit it.

Risk

Logf is part of the exported Logger interface. Callers with custom implementations that already append their own newline would see double newlines until they update. This is a minor cosmetic issue and the fix aligns the interface with Go conventions (log.Printf, testing.T.Logf).

Scope

Purely internal cleanup. No behavior change beyond log formatting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    Status
    Todo

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions