go-log/internal_logger.go

43 lines
626 B
Go
Raw Normal View History

package log
2021-02-05 01:19:59 +00:00
import (
"io"
2021-02-10 19:40:40 +00:00
"time"
2021-02-05 01:19:59 +00:00
)
type internalLogger struct {
prefix string
style string
2021-02-10 19:40:40 +00:00
begin time.Time
2021-02-05 01:19:59 +00:00
writer io.Writer
2021-02-09 20:51:40 +00:00
mutedAlert bool
2021-02-05 02:25:22 +00:00
mutedDebug bool
mutedError bool
mutedFatal bool
mutedHighlight bool
mutedInform bool
mutedPanic bool
mutedTrace bool
mutedWarn bool
2021-02-05 01:19:59 +00:00
}
func NewLogger(writer io.Writer, parameters ...string) Logger {
logger := internalLogger{
writer:writer,
}
if 1 <= len(parameters) {
style := parameters[0]
switch style {
case "color","colour":
logger.style = "color"
default:
logger.style = ""
}
}
2021-02-05 02:25:22 +00:00
return &logger
2021-02-05 01:19:59 +00:00
}