gocommon/log/hooks/file/enum.go
Matthieu 'JP' DERASSE bef0d38f1e
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone Build is passing
feat(log): Handle multiple log formatter for file
2022-12-11 12:43:39 +00:00

35 lines
754 B
Go

package file
// OutputFormat Enum
// OutputFormat is the format that will be use to store log in the file.
type OutputFormat string
//nolint:exported // keeping the enum simple and readable.
const (
OutputFormat_TEXT OutputFormat = "TEXT"
OutputFormat_JSON OutputFormat = "JSON"
)
// IsValid check if the gaven OutputFormat is part of the list of handled provider name.
func (e OutputFormat) IsValid() bool {
for _, v := range GetListOutputFormat() {
if e == v {
return true
}
}
return false
}
func (e OutputFormat) String() string {
return string(e)
}
// GetListOutputFormat return a the list of possible OutputFormat.
func GetListOutputFormat() []OutputFormat {
return []OutputFormat{
OutputFormat_TEXT,
OutputFormat_JSON,
}
}