Closed urso closed 2 years ago
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Closing for now as all tasks listed were achieved.
In order to better support structured logging, we want to get rid of the global logger functions. The API of the global logger functions is not in line with the methods defined by
(*logp).Logger
.For now we will focus on libbeat first.
Refactoring Notes/Tips:
logp.Debug/Info/Warn/...
withf
variants like(*Logger).Debugf/Infof/Warnf/...
if a format string has been used. Otherwise stick with(*Logger).Debug/Info/...
%+v
when logging an error using a format string. Some logger libraries implement fmt.Formatter and will print the wrapped error only if+
is given.logp.Debug
accepts as first argument theselector
name.*logp.Logger
instances have a name and the selector name must be removed when switching to(*Logger).Debugf
(*Logger).Named
(prefer(*Logger).Named
) to create a logger instance in order to replace logp.MakeDebug. For now in unit tests you can uselogp.L()
if you need to pass a logger you don't care aboutlogp.NewLogger
to reduce the amount of transitive changes.NewLogger
will be removed in the future as well, but for now it can help to reduce PR sizes.tags=nologpglobal
to compile/test a package without logp global logging functions being availableTasks