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

Add SetLogCaller to standard logger #37

Closed andrewemeryanz closed 4 years ago

andrewemeryanz commented 4 years ago

This change adds the SetLogCaller method to the standard logger that includes a reference to the calling function within the logged string.

To provide the ability to extend the behaviour of the logged caller reference (to render the reference as a url link to the project in which the calling function can be found), the SetCodeReferenceFormatter method is also provided. When set, the formatter will render the caller reference activated by SetLogCaller.