X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;f=src%2Fctx.go;h=88fd852ecb17f1d6fdec67f199c6674e790d34d5;hb=5a9bf58a2638e42f2d42fa4d43c363a664fe8198;hp=d83882800180f176b6fcf03ee632aba00a427ef8;hpb=745d9fafe84b0745b84d93900722216dde6b88cc;p=nncp.git diff --git a/src/ctx.go b/src/ctx.go index d838828..88fd852 100644 --- a/src/ctx.go +++ b/src/ctx.go @@ -19,6 +19,7 @@ package nncp import ( "errors" + "fmt" "io/ioutil" "log" "os" @@ -65,13 +66,16 @@ func (ctx *Ctx) FindNode(id string) (*Node, error) { func (ctx *Ctx) ensureRxDir(nodeId *NodeId) error { dirPath := filepath.Join(ctx.Spool, nodeId.String(), string(TRx)) + logMsg := func(les LEs) string { + return fmt.Sprintf("Ensuring directory %s existence", dirPath) + } if err := os.MkdirAll(dirPath, os.FileMode(0777)); err != nil { - ctx.LogE("dir-ensure", LEs{{"Dir", dirPath}}, err, "") + ctx.LogE("dir-ensure-mkdir", LEs{{"Dir", dirPath}}, err, logMsg) return err } fd, err := os.Open(dirPath) if err != nil { - ctx.LogE("dir-ensure", LEs{{"Dir", dirPath}}, err, "") + ctx.LogE("dir-ensure-open", LEs{{"Dir", dirPath}}, err, logMsg) return err } return fd.Close()