-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlevel.go
More file actions
58 lines (53 loc) · 2.08 KB
/
level.go
File metadata and controls
58 lines (53 loc) · 2.08 KB
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
50
51
52
53
54
55
56
57
58
// Logger-Go (github.com/anonyindian/logger)
// Copyright (C) 2022
// Veer Pratap Singh <hello@veer.codes>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser Public License for more details.
//
// You should have received a copy of the GNU Lesser Public License
// along with this program. If not, see [http://www.gnu.org/licenses/].
package logger
// Level type is to define the logging levels, which would be used for saturating logs.
//
// Note: In case you create new levels, they must be added to the LevelToNum and LevelToColor maps.
type Level string
var (
// LevelDebug is the DEBUG level which should be used for debugging.
LevelDebug Level = "DEBUG"
// LevelMain is the MAIN level which should be used for logging main arguments.
LevelMain Level = "MAIN"
// LevelInfo is the INFO level which should be used for logging all basic arguments.
LevelInfo Level = "INFO"
// LevelError is the ERROR level which should be used for logging all errors.
LevelError Level = "ERROR"
// LevelCritical is the CRITICAL level which should be used for logging all critical things.
LevelCritical Level = "CRITICAL"
// LevelToNum map converts the provided level to its integral value.
//
// One should add custom created levels to this map for proper functioning.
LevelToNum = map[Level]int{
LevelDebug: -1,
LevelInfo: 0,
LevelMain: 1,
LevelError: 2,
LevelCritical: 3,
}
// LevelToColor map converts the provided level to its defined color.
//
// One should add custom created levels to this map for proper functioning.
LevelToColor = map[Level]color{
LevelDebug: white,
LevelInfo: blue,
LevelMain: green,
LevelError: purple,
LevelCritical: red,
}
)