go-log/internal_logger.go

39 lines
579 B
Go
Raw Normal View History

2021-02-05 01:19:59 +00:00
package flog
import (
"io"
)
type internalLogger struct {
prefix string
style string
writer io.Writer
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
}