[windows-x] Initial support for dev

This commit is contained in:
Lea Anthony
2021-08-18 22:13:45 +10:00
parent 6923ea301b
commit 31468aa177
5 changed files with 234 additions and 12 deletions

View File

@@ -1,5 +1,10 @@
package logger
import (
"fmt"
"strings"
)
// LogLevel is an unsigned 8bit int
type LogLevel uint8
@@ -20,6 +25,22 @@ const (
ERROR LogLevel = 5
)
var logLevelMap = map[string]LogLevel{
"trace": TRACE,
"debug": DEBUG,
"info": INFO,
"warning": WARNING,
"error": ERROR,
}
func StringToLogLevel(input string) (LogLevel, error) {
result, ok := logLevelMap[strings.ToLower(input)]
if !ok {
return ERROR, fmt.Errorf("invalid log level: %s", input)
}
return result, nil
}
// Logger specifies the methods required to attach
// a logger to a Wails application
type Logger interface {