✨ Add AddFormatter function to allow custom builds to register new formatters
This commit is contained in:
parent
0fbd64247a
commit
17a1cf1ade
5 changed files with 60 additions and 31 deletions
|
|
@ -5,28 +5,19 @@ import (
|
|||
"github.com/spf13/viper"
|
||||
)
|
||||
|
||||
func newNull(ff *viper.Viper) (Formatter, error) {
|
||||
return &Null{}, nil
|
||||
const FormatNull = "zero"
|
||||
|
||||
func newNull(*viper.Viper) (Formatter, error) {
|
||||
return Null{}, nil
|
||||
}
|
||||
|
||||
type Null struct{}
|
||||
|
||||
func (n *Null) Name() string {
|
||||
return "zero"
|
||||
func (Null) Name() string {
|
||||
return FormatNull
|
||||
}
|
||||
|
||||
func (n *Null) Meta(m models.Meta) (o []byte, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (n *Null) Entry(e models.Entry) (o []byte, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (n *Null) Log(l models.Log) (o []byte, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (n *Null) Logs(logs []models.Log) (out []byte, err error) {
|
||||
return
|
||||
}
|
||||
func (Null) Meta(m models.Meta) (o []byte, err error) { return }
|
||||
func (Null) Entry(e models.Entry) (o []byte, err error) { return }
|
||||
func (Null) Log(l models.Log) (o []byte, err error) { return }
|
||||
func (Null) Logs(logs []models.Log) (out []byte, err error) { return }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue