refactor(LogTypes): Added String() func
This commit is contained in:
parent
88335ebdd1
commit
c99a7f5917
1 changed files with 22 additions and 5 deletions
|
|
@ -1,10 +1,27 @@
|
||||||
package SQL
|
package SQL
|
||||||
|
|
||||||
|
import "fmt"
|
||||||
|
|
||||||
type LogType int64
|
type LogType int64
|
||||||
|
|
||||||
const(
|
const (
|
||||||
LogInfo LogType = 1
|
LogInfo LogType = 1
|
||||||
LogWarning = 2
|
LogWarning = 2
|
||||||
LogError = 3
|
LogError = 3
|
||||||
LogFatal = 4
|
LogFatal = 4
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func (e LogType) String() string {
|
||||||
|
switch e {
|
||||||
|
case LogInfo:
|
||||||
|
return "INFO"
|
||||||
|
case LogWarning:
|
||||||
|
return "WARNING"
|
||||||
|
case LogError:
|
||||||
|
return "ERROR"
|
||||||
|
case LogFatal:
|
||||||
|
return "FATAL"
|
||||||
|
default:
|
||||||
|
return fmt.Sprintf("%d", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Reference in a new issue