update gomod/str

This commit is contained in:
bryanqiu 2022-10-12 21:58:20 +08:00
parent d68105842d
commit 813dc81ea1
2 changed files with 11 additions and 8 deletions

2
go.mod
View File

@ -1,3 +1,5 @@
module qoobing.com/gomod/log
go 1.16
require qoobing.com/gomod/str v1.0.0

17
log.go
View File

@ -9,19 +9,20 @@ import (
"log"
"os"
"path/filepath"
"qoobing.com/gomod/str"
"runtime"
"runtime/debug"
"strings"
"sync"
"time"
"qoobing.com/gomod/str"
)
var (
glogger *log.Logger = nil
once sync.Once = sync.Once{}
mylogger *Logger = nil
modellogs map[string]*Logger = map[string]*Logger{}
glogger *log.Logger = nil
once sync.Once = sync.Once{}
mylogger *Logger = nil
modellogs map[string]*Logger = map[string]*Logger{}
)
const ErrLogPanic = "~~~~panic~~~~~~"
@ -63,9 +64,9 @@ func New(model string) (logger *Logger) {
if model == "" {
model = "undefine"
}
if _, ok := modellogs[model]; ok{
if _, ok := modellogs[model]; ok {
return modellogs[model]
}else{
} else {
modellogs[model] = &Logger{model: model, logger: glogger}
return modellogs[model]
}
@ -250,7 +251,7 @@ func initlog() {
glogger = openlog(LOGFILENAME)
mylogger = New("system")
for _, l := range modellogs{
for _, l := range modellogs {
l.logger = glogger
}
}