gocommon/log/hooks/file/enum.go

35 lines
754 B
Go
Raw Permalink Normal View History

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,
}
}