提交 2c38487e 作者: Brian Tiger Chow

fix(eventlog) configure logging if repo is initialized

License: MIT
Signed-off-by: 's avatarBrian Tiger Chow <brian@perfmode.com>
上级 6c94a071
......@@ -24,6 +24,7 @@ import (
u "github.com/jbenet/go-ipfs/util"
"github.com/jbenet/go-ipfs/util/debugerror"
eventlog "github.com/jbenet/go-ipfs/util/eventlog"
repo "github.com/jbenet/go-ipfs/repo"
)
// log is the command logger
......@@ -271,7 +272,7 @@ func callPreCommandHooks(details cmdDetails, req cmds.Request, root *cmds.Comman
// When the upcoming command may use the config and repo, we know it's safe
// for the log config hook to touch the config/repo
if details.usesConfigAsInput() && details.usesRepo() {
if repo.IsInitialized(req.Context().ConfigRoot) {
log.Debug("Calling hook: Configure Event Logger")
cfg, err := req.Context().GetConfig()
if err != nil {
......
package repo
import util "github.com/jbenet/go-ipfs/util"
// IsInitialized returns true if the path is home to an initialized IPFS
// repository.
func IsInitialized(path string) bool {
if !util.FileExists(path) {
return false
}
// TODO add logging check
// TODO add datastore check
// TODO add config file check
return true
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论