Skip to content

Commit

Permalink
string as array bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Arnheiter committed Jan 28, 2021
1 parent 76a01f2 commit 05eb9c4
Showing 1 changed file with 51 additions and 32 deletions.
83 changes: 51 additions & 32 deletions log.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
type LogLevelType int

const (
TRACE LogLevelType = iota
TRACE LogLevelType = iota
DEBUG
INFO
WARN
Expand All @@ -21,69 +21,88 @@ var (
)

func Println(args ...interface{}) {
Infoln(args)
Infoln(args...)
}
func Printf(format string, args ...interface{}) {
Infof(format, args)
Infof(format, args...)
}


func Fatalln (args ...interface{}) {
if LogLevel <= FATAL { log.Fatal(args)}
func Fatalln(args ...interface{}) {
if LogLevel <= FATAL {
log.Fatal(args...)
}
}
func Fatalf (format string, args ...interface{}) {
if LogLevel <= FATAL { log.Fatal(format, args)}
func Fatalf(format string, args ...interface{}) {
if LogLevel <= FATAL {
log.Fatalf(format, args...)
}
}


func Errorln (args ...interface{}) {
if LogLevel <= ERROR { log.Println(args)}
func Errorln(args ...interface{}) {
if LogLevel <= ERROR {
log.Println(args...)
}
}
func Errorf (format string, args ...interface{}) {
if LogLevel <= ERROR { log.Printf(format, args)}
func Errorf(format string, args ...interface{}) {
if LogLevel <= ERROR {
log.Printf(format, args...)
}
}


func Warnln (args ...interface{}) {
if LogLevel <= WARN { log.Println(args)}
func Warnln(args ...interface{}) {
if LogLevel <= WARN {
log.Println(args...)
}
}
func Warnf (format string, args ...interface{}) {
if LogLevel <= WARN { log.Printf(format, args)}
func Warnf(format string, args ...interface{}) {
if LogLevel <= WARN {
log.Printf(format, args...)
}
}


func Infoln (args ...interface{}) {
if LogLevel <= INFO { log.Println(args)}
func Infoln(args ...interface{}) {
if LogLevel <= INFO {
log.Println(args...)
}
}
func Infof (format string, args ...interface{}) {
if LogLevel <= INFO { log.Printf(format, args)}
func Infof(format string, args ...interface{}) {
if LogLevel <= INFO {
log.Printf(format, args...)
}
}

func Debugln( args ...interface{}) {
if LogLevel <= DEBUG { log.Println(args)}
func Debugln(args ...interface{}) {
if LogLevel <= DEBUG {
log.Println(args...)
}
}
func Debugf(format string, args ...interface{}) {
if LogLevel <= DEBUG { log.Printf(format, args)}
if LogLevel <= DEBUG {
log.Printf(format, args...)
}
}

func Traceln( args ...interface{}) {
if LogLevel <= TRACE { log.Println(args)}
func Traceln(args ...interface{}) {
if LogLevel <= TRACE {
log.Println(args...)
}
}
func Tracef(format string, args ...interface{}) {
if LogLevel <= TRACE { log.Printf(format, args)}
if LogLevel <= TRACE {
log.Printf(format, args...)
}
}


func Error(args ...interface{}) {
log.Println(args)
}

func Fatal(err error) {
log.Fatal(err)
}
func Handler (handler http.Handler) http.Handler {
func Handler(handler http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Debugln("http request", r.Method, r.URL)
Debugln("http request", r.Method, r.URL)
handler.ServeHTTP(w, r)
})
}

0 comments on commit 05eb9c4

Please sign in to comment.