gocommon/log/enum.go

38 lines
856 B
Go
Raw Permalink Normal View History

2022-11-26 20:45:32 +00:00
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.
2022-11-26 20:45:32 +00:00
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,
}
}