Go R1 Day 50

At this point, I’m still struggling with the proper way to abstract a logging wrapper that calls a logging library. There’s enough boilerplate for setup of my preferred defaults in zerolog that I want to include a wrapper to organize this and return the logger.

This tends to look like:

type Logger struct {
  Logger *zerolog.Logger

This results in a pretty lengthy call with logger.Logger.Info().Str("key", "value").Msg("message"). I’m also having issues with the embedded logger not returning the correct methods transparently back to the caller.

I’ve tested with internal/logger and pkg/logger with similar issues. This one I’ll have to come back round to.


Likes  (2) Reposts  (3)