anz-bank / pkg

Common ANZ Go packages
https://pkg.go.dev/github.com/anz-bank/pkg
Apache License 2.0
1 stars 9 forks source link

Include NewForwardingHook to connect one logger to another #51

Closed andrewemeryanz closed 4 years ago

andrewemeryanz commented 4 years ago

The AddHooks config allows log entries to be received outside the logger, however, the Logger interface doesn't provide a means to log the LogEntry objects received within the Hook.

The NewForwardingHook method provides a mechanism to forward log entries directly to another Logger. This method is preferred over the addition of a method to the Logger interface in an attempt to keep the Logger interface clean.