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

Entry and Formatter types #36

Closed andrewemeryanz closed 4 years ago

andrewemeryanz commented 4 years ago

Previously, the SetFormatter method method came with the requirement that the formatter provided needed to be a logrus.Formatter component. This exposed the internal components of the pkg log framework, making the addition of concepts (such as hooks) also reliant on these internal components.

This change adds two types: Entry and Formatter, where Formatter is responsible for formatting a log Entry. Backwards compatibility is maintained with the SetFormatter method (through type checking) to support the setting of logrus.Formatter components. However, this change is not completely backwards compatible because the exported Formatter name, previously an integer type value, now represents the formatting object. The previous Formatter name has been renamed to FormatterType.