Skip to content

Conversation

@belimawr
Copy link
Contributor

@belimawr belimawr commented Jun 18, 2025

What does this PR do?

Skip one caller to show the correct file/line that issued the log

Why is it important?

When using logp.NewDevelopmentLogger, logp.NewInMemoryLocal, etc. The returned logger was logging logp/logger.go as the source of the log entry.

How to test locally

  1. Create the following test on a project that uses logp, or any other place
func TestLogger(t *testing.T) {
	logger, err := logp.NewDevelopmentLogger("selector")
	if err != nil {
		t.Fatal(err)
	}

	logger.Info("foo bar")
}
  1. Run the test.
  2. The output must contain the correct file name and line instead of logp/logger.go:213

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have added tests that prove my fix is effective or that my feature works

## Author's Checklist
## Related issues

@belimawr belimawr self-assigned this Jun 18, 2025
@belimawr belimawr requested a review from a team as a code owner June 18, 2025 19:00
@belimawr belimawr added the Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team label Jun 18, 2025
@belimawr belimawr requested review from andrzej-stencel and leehinman and removed request for a team June 18, 2025 19:00
@elasticmachine
Copy link
Collaborator

💚 Build Succeeded

cc @belimawr

@belimawr belimawr merged commit aad2c0e into elastic:main Jun 18, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Team:Elastic-Agent-Data-Plane Label for the Agent Data Plane team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants