Skip to content

Log caller (file:line) to help debugging errors #5342

@akrem-chabchoub

Description

@akrem-chabchoub

Summary

Add optional file/line field to log lines, click it in the terminal to jump to that spot in the editor.

Motivation

Easier debugging: see where log lines come from without grepping. Feature exists in pkg/log, not exposed.

Implementation

Enable caller in logger; config/flag to turn on/off and pick category (error vs all). Reuse WithCaller, optionally WithCallerFunc. .

Drawbacks

runtime.Caller() costs CPU per line; more log bytes. Default off, category=error only to limit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs-triagingnew issues that need triaging

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions