~mendelmaleh/log

903e1386f5244e88e5ca10c630db73c17fed8ec3 — Mendel E 10 months ago 2d9e3a3
Move LevelMap to top level package
3 files changed, 11 insertions(+), 12 deletions(-)

D handlers/all.go
M handlers/io_writer.go
M log.go
D handlers/all.go => handlers/all.go +0 -11
@@ 1,11 0,0 @@
package handlers

// LevelMap has the string values for log.Level
var LevelMap = map[int]string{
	0: "debug",
	1: "info",
	2: "warn",
	3: "error",
	4: "fatal",
	5: "panic",
}

M handlers/io_writer.go => handlers/io_writer.go +1 -1
@@ 14,7 14,7 @@ type IOWriter struct {

// Write implements the log.Handler interface
func (h IOWriter) Write(l *log.Log) {
	level := strings.ToUpper(LevelMap[l.Level])
	level := strings.ToUpper(log.LevelMap[l.Level])
	time := l.Time.Format("2006/01/02 15:04:05")
	b := []byte(strings.Join([]string{time, level, l.Text}, ": "))


M log.go => log.go +10 -0
@@ 23,6 23,16 @@ const (
	LPanic
)

// LevelMap has the string values for Log.Level
var LevelMap = map[int]string{
	0: "debug",
	1: "info",
	2: "warn",
	3: "error",
	4: "fatal",
	5: "panic",
}

// Logger type
type Logger struct {
	handlers []Handler