update gomod/str
This commit is contained in:
parent
d68105842d
commit
813dc81ea1
2
go.mod
2
go.mod
@ -1,3 +1,5 @@
|
||||
module qoobing.com/gomod/log
|
||||
|
||||
go 1.16
|
||||
|
||||
require qoobing.com/gomod/str v1.0.0
|
||||
|
17
log.go
17
log.go
@ -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
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user