gocommon/log/enum.go
2023-01-10 21:12:50 +00:00

38 lines
856 B
Go

package log
// Provider Name Enum
// ProviderName is a provider that will receive the logs.
type ProviderName string
//nolint:exported // keeping the enum simple and readable.
const (
ProviderName_NONE ProviderName = "NONE"
ProviderName_FILE ProviderName = "FILE"
ProviderName_GELF ProviderName = "GELF"
)
// IsValid check if the gaven ProviderName is part of the list of handled provider name.
func (e ProviderName) IsValid() bool {
for _, v := range GetListProviderName() {
if e == v {
return true
}
}
return false
}
// String will transform a providerName into a string.
func (e ProviderName) String() string {
return string(e)
}
// GetListProviderName return a the list of possible ProviderName.
func GetListProviderName() []ProviderName {
return []ProviderName{
ProviderName_NONE,
ProviderName_FILE,
ProviderName_GELF,
}
}