mirror of
https://github.com/kovetskiy/mark.git
synced 2026-04-28 18:42:34 +00:00
implement macros & includes
This commit is contained in:
100
pkg/log/log.go
Normal file
100
pkg/log/log.go
Normal file
@@ -0,0 +1,100 @@
|
||||
package log
|
||||
|
||||
import (
|
||||
"github.com/kovetskiy/lorg"
|
||||
"github.com/reconquest/cog"
|
||||
)
|
||||
|
||||
var (
|
||||
log *cog.Logger
|
||||
)
|
||||
|
||||
func Init(debug, trace bool) {
|
||||
stderr := lorg.NewLog()
|
||||
stderr.SetIndentLines(true)
|
||||
stderr.SetFormat(
|
||||
lorg.NewFormat("${time} ${level:[%s]:right:short} ${prefix}%s"),
|
||||
)
|
||||
|
||||
log = cog.NewLogger(stderr)
|
||||
|
||||
if debug {
|
||||
log.SetLevel(lorg.LevelDebug)
|
||||
}
|
||||
|
||||
if trace {
|
||||
log.SetLevel(lorg.LevelTrace)
|
||||
}
|
||||
}
|
||||
|
||||
func Fatalf(
|
||||
reason interface{},
|
||||
message string,
|
||||
args ...interface{},
|
||||
) {
|
||||
log.Fatalf(reason, message, args...)
|
||||
}
|
||||
|
||||
func Errorf(
|
||||
reason interface{},
|
||||
message string,
|
||||
args ...interface{},
|
||||
) {
|
||||
log.Errorf(reason, message, args...)
|
||||
}
|
||||
|
||||
func Warningf(
|
||||
reason interface{},
|
||||
message string,
|
||||
args ...interface{},
|
||||
) {
|
||||
log.Warningf(reason, message, args...)
|
||||
}
|
||||
|
||||
func Infof(
|
||||
context interface{},
|
||||
message string,
|
||||
args ...interface{},
|
||||
) {
|
||||
log.Infof(context, message, args...)
|
||||
}
|
||||
|
||||
func Debugf(
|
||||
context interface{},
|
||||
message string,
|
||||
args ...interface{},
|
||||
) {
|
||||
log.Debugf(context, message, args...)
|
||||
}
|
||||
|
||||
func Tracef(
|
||||
context interface{},
|
||||
message string,
|
||||
args ...interface{},
|
||||
) {
|
||||
log.Tracef(context, message, args...)
|
||||
}
|
||||
|
||||
func Fatal(values ...interface{}) {
|
||||
log.Fatal(values...)
|
||||
}
|
||||
|
||||
func Error(values ...interface{}) {
|
||||
log.Error(values...)
|
||||
}
|
||||
|
||||
func Warning(values ...interface{}) {
|
||||
log.Warning(values...)
|
||||
}
|
||||
|
||||
func Info(values ...interface{}) {
|
||||
log.Info(values...)
|
||||
}
|
||||
|
||||
func Debug(values ...interface{}) {
|
||||
log.Debug(values...)
|
||||
}
|
||||
|
||||
func Trace(values ...interface{}) {
|
||||
log.Trace(values...)
|
||||
}
|
||||
Reference in New Issue
Block a user