From 34f9c554589c16628989fdf31a67dfbef650b275 Mon Sep 17 00:00:00 2001 From: mcrakhman Date: Mon, 24 Oct 2022 12:09:59 +0200 Subject: [PATCH] Better logs in space storage --- node/storage/spacestorage.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/node/storage/spacestorage.go b/node/storage/spacestorage.go index b9406fb3..f82d85ba 100644 --- a/node/storage/spacestorage.go +++ b/node/storage/spacestorage.go @@ -28,7 +28,7 @@ type spaceStorage struct { } func newSpaceStorage(rootPath string, spaceId string) (store spacestorage.SpaceStorage, err error) { - log.With(zap.String("id", spaceId)).Debug("space storage opened with new") + log.With(zap.String("id", spaceId)).Debug("space storage opening with new") dbPath := path.Join(rootPath, spaceId) objDb, err := pogreb.Open(dbPath, defPogrebOptions) if err != nil { @@ -37,6 +37,7 @@ func newSpaceStorage(rootPath string, spaceId string) (store spacestorage.SpaceS defer func() { if err != nil { + log.With(zap.String("id", spaceId), zap.Error(err)).Warn("failed to open storage") objDb.Close() } }() @@ -79,7 +80,7 @@ func newSpaceStorage(rootPath string, spaceId string) (store spacestorage.SpaceS } func createSpaceStorage(rootPath string, payload spacestorage.SpaceStorageCreatePayload) (store spacestorage.SpaceStorage, err error) { - log.With(zap.String("id", payload.SpaceHeaderWithId.Id)).Debug("space storage opened with create") + log.With(zap.String("id", payload.SpaceHeaderWithId.Id)).Debug("space storage creating") dbPath := path.Join(rootPath, payload.SpaceHeaderWithId.Id) db, err := pogreb.Open(dbPath, defPogrebOptions) if err != nil { @@ -87,6 +88,7 @@ func createSpaceStorage(rootPath string, payload spacestorage.SpaceStorageCreate } defer func() { + log.With(zap.String("id", payload.SpaceHeaderWithId.Id), zap.Error(err)).Warn("failed to create storage") if err != nil { db.Close() }