hegel icon indicating copy to clipboard operation
hegel copied to clipboard

Middleware logger makes it difficult to debug

Open jacobweinstock opened this issue 2 months ago • 0 comments

Currently handlers use ctx.AbortWithError to return errors. The logger in middleware (https://github.com/tinkerbell/hegel/blob/d74d351c3f6643a98247884f08850a0ed1368b06/internal/logger/logger.go#L14) then handles logging error messages. This causes all log lines to report the same caller location. hegel/internal/logger/logger.go:53 https://github.com/tinkerbell/hegel/blob/d74d351c3f6643a98247884f08850a0ed1368b06/internal/logger/logger.go#L53

This makes debugging challenging and logging of the caller pointless.

Expected Behaviour

Current Behaviour

Possible Solution

One option could be to pass a logger into all handlers. I'm certain there are are others but i'll need to dig into the code and this space mentally a bit more.

Steps to Reproduce (for bugs)

Context

Your Environment

  • Operating System and version (e.g. Linux, Windows, MacOS):

  • How are you running Tinkerbell? Using Vagrant & VirtualBox, Vagrant & Libvirt, on Packet using Terraform, or give details:

  • Link to your project or a code example to reproduce issue:

jacobweinstock avatar Apr 15 '24 16:04 jacobweinstock