-
Notifications
You must be signed in to change notification settings - Fork 63
/
type.go
49 lines (44 loc) · 865 Bytes
/
type.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) 2022, Unikraft GmbH and The KraftKit Authors.
// Licensed under the BSD-3-Clause License (the "License").
// You may not use this file expect in compliance with the License.
package log
import "strings"
// LoggerType controls how log statements are output
type LoggerType uint
// Logger types
const (
QUIET LoggerType = iota
BASIC
FANCY
JSON
)
func LoggerTypeFromString(name string) LoggerType {
name = strings.ToLower(name)
switch name {
case "quiet":
return QUIET
case "basic":
return BASIC
case "fancy":
return FANCY
case "json":
return JSON
default:
return BASIC
}
}
func LoggerTypeToString(t LoggerType) string {
switch t {
case QUIET:
return "quiet"
case BASIC:
return "basic"
case FANCY:
return "fancy"
case JSON:
return "json"
default:
return "basic"
}
}