aboutsummaryrefslogtreecommitdiff
path: root/utils/logger/types.go
blob: d9ddfde14051163c91acbc7f623eea9a6dbd8560 (plain)
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
package logger

import (
	"io"
	"sync"
)

type LogLevel string

const (
	Debug   LogLevel = "DEBUG"
	Info    LogLevel = "INFO"
	Warning LogLevel = "WARN"
	Error   LogLevel = "ERROR"
	Success LogLevel = "SUCCESS"
)

const (
	ColorReset   = "\033[0m"
	ColorCyan    = "\033[36m"
	ColorGray    = "\033[90m"
	ColorDebug   = "\033[90m"
	ColorInfo    = "\033[97m"
	ColorWarning = "\033[33m"
	ColorError   = "\033[31m"
	ColorSuccess = "\033[32m"
)

type Logger struct {
	prefix       string
	timestamp    bool
	timeFormat   string
	enableColors bool
	stdOutWriter io.Writer
	stdErrWriter io.Writer
	mu           sync.Mutex
}

type Option func(*Logger)