Wednesday, May 1, 2024
HomeGolangGolang App with Hexagonal Structure with logging middleware - Technical Dialogue

Golang App with Hexagonal Structure with logging middleware – Technical Dialogue


I’m growing an software in golang with hexagonal structure. I required to print the requestId within the logs the place ever I need to use logs.

To do that, I’m producing a random request Id and attaching it with the GIN context. And suppose I need to log information at repository adapter. My downside is that, on this case to have the ability to log I have to move the context object to each elements(layers), adapter to ports to area to repository and every strategies the place I need to log request Id. This might be not based on hexagonal structure and clear code. So, I dont need to move context to every elements and strategies to have the ability to get the knowledge set in GIN Context Is there a approach like we do in spring, we will get the precept object wherever as soon as it get set in spring safety context.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments