Skip to content

Commit

Permalink
chore: improve logging
Browse files Browse the repository at this point in the history
  • Loading branch information
GalvinGao authored and AlvISsReimu committed Mar 10, 2022
1 parent fcca397 commit 30ab8a0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion internal/pkg/cache/set.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ func (c *Set) Get(key string, dest interface{}) error {
key = c.key(key)
result, ok := c.c.Get(key)
if !ok {
if l := log.Trace(); l.Enabled() {
l.Str("key", key).Msg("cache entry not found")
}
return ErrNotFound
}

Expand All @@ -48,8 +51,10 @@ func (c *Set) Get(key string, dest interface{}) error {
}

func (c *Set) Set(key string, value interface{}, expire time.Duration) error {
log.Trace().Str("key", key).Msg("setting value to cache")
key = c.key(key)
if l := log.Trace(); l.Enabled() {
l.Str("key", key).Msg("setting value to cache")
}
c.c.Set(key, value, expire)
return nil
}
Expand Down

0 comments on commit 30ab8a0

Please sign in to comment.