feat(log): tee logs to file and stdout (#42)

This commit is contained in:
Hexxa 2021-03-06 10:44:24 +08:00 committed by GitHub
parent 6bd8d2422b
commit 9b2157ac6a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 98 additions and 22 deletions

View file

@ -2,6 +2,7 @@ package depidx
import (
"github.com/ihexxa/gocfg"
"go.uber.org/zap"
"github.com/ihexxa/quickshare/src/cryptoutil"
"github.com/ihexxa/quickshare/src/fs"
@ -23,6 +24,7 @@ type Deps struct {
kv kvstore.IKVStore
uploader IUploader
id idgen.IIDGen
logger *zap.SugaredLogger
}
func NewDeps(cfg gocfg.ICfg) *Deps {
@ -60,3 +62,11 @@ func (deps *Deps) ID() idgen.IIDGen {
func (deps *Deps) SetID(ider idgen.IIDGen) {
deps.id = ider
}
func (deps *Deps) Log() *zap.SugaredLogger {
return deps.logger
}
func (deps *Deps) SetLog(logger *zap.SugaredLogger) {
deps.logger = logger
}