https://www.sheldonhull.com/go-r1-day-34/
2021-04-08T03:28:38Z
117 words
One minute
progress
figured out how to import util/logger.go as a package
after much confusion due to logger, log, *zerolog.Logger and more variables all deviously similar in name… how to pass around the initialized package logger that I configure.
learned that global scope and package scoped loggers being initialized at run is concerned an anti-pattern
properly wrapping to avoid the log initialization on import with type Logger struct { logger: *zerolog.Logger; } as an example avoids the same behavior as: var Log *zerolog.Logger
will evaluate better scoping in the future, but for now figured it would be a 🚀 #shipit moment to improve as I can later. 1
Webmentions
(No webmentions yet.)