Remix.run Logo
roncesvalles 2 days ago

There's a default logger that's used when you call package-level functions (as opposed to methods on an instance of slog.Logger). The default logger is probably what you configured in your main package.

In my opinion this is perfectly idiomatic Go. Sometimes the package itself hosts one global instance. If you think that's "magic" then you must think all of Go is magic. It helps to think of a package in Go as equivalent to a single Java class. Splitting up a Go package's code into multiple files is purely cosmetic.

sethammons 2 days ago | parent [-]

If you need log output in tests, you should use an instance of a logger.

More teams should be validating their logging and should be leveraging structured logging and getting valuable logging insights/events.