From e681c9cfca0eb3353f44eb5a4fa4868b56c738e4 Mon Sep 17 00:00:00 2001 From: alfred-mk Date: Thu, 20 Mar 2025 15:23:36 +0300 Subject: [PATCH] Added debug logs --- handlers/application/menuhandler.go | 6 ++---- store/db/sub_prefix_db.go | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/handlers/application/menuhandler.go b/handlers/application/menuhandler.go index 8a8d6ed..d82cd51 100644 --- a/handlers/application/menuhandler.go +++ b/handlers/application/menuhandler.go @@ -1931,7 +1931,6 @@ func (h *MenuHandlers) InitiateTransaction(ctx context.Context, sym string, inpu // and sets the first as the default voucher, if no active voucher is set. func (h *MenuHandlers) SetDefaultVoucher(ctx context.Context, sym string, input []byte) (resource.Result, error) { var res resource.Result - var err error userStore := h.userdataStore sessionId, ok := ctx.Value("SessionId").(string) @@ -1943,8 +1942,9 @@ func (h *MenuHandlers) SetDefaultVoucher(ctx context.Context, sym string, input // check if the user has an active sym activeSym, err := userStore.ReadEntry(ctx, sessionId, storedb.DATA_ACTIVE_SYM) - + logg.InfoCtxf(ctx, "The activeSym in SetDefaultVoucher:", "activeSym", string(activeSym)) if err != nil { + logg.ErrorCtxf(ctx, "The err", err) logg.InfoCtxf(ctx, "Checking the data as no activeSym", "DATA_ACTIVE_SYM", storedb.DATA_ACTIVE_SYM) if db.IsNotFound(err) { @@ -2016,8 +2016,6 @@ func (h *MenuHandlers) SetDefaultVoucher(ctx context.Context, sym string, input return res, err } - logg.InfoCtxf(ctx, "The activeSym in SetDefaultVoucher:", "activeSym", string(activeSym)) - res.FlagReset = append(res.FlagReset, flag_no_active_voucher) return res, nil diff --git a/store/db/sub_prefix_db.go b/store/db/sub_prefix_db.go index ae59171..156fbc2 100644 --- a/store/db/sub_prefix_db.go +++ b/store/db/sub_prefix_db.go @@ -33,11 +33,14 @@ func (s *SubPrefixDb) toKey(k []byte) []byte { func (s *SubPrefixDb) Get(ctx context.Context, key []byte) ([]byte, error) { s.store.SetPrefix(db.DATATYPE_USERDATA) key = s.toKey(key) + logg.InfoCtxf(ctx, "SubPrefixDb Get log", "key", string(key)) + return s.store.Get(ctx, key) } func (s *SubPrefixDb) Put(ctx context.Context, key []byte, val []byte) error { s.store.SetPrefix(db.DATATYPE_USERDATA) key = s.toKey(key) + logg.InfoCtxf(ctx, "SubPrefixDb Put log", "key", string(key)) return s.store.Put(ctx, key, val) }