Skip to content

Commit b07869b

Browse files
author
Avery Levin
committed
added logging
1 parent 39e163f commit b07869b

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

cache_helper/decorators.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import logging
2+
13
try:
24
from _pylibmc import Error as CacheSetError
35
except ImportError:
@@ -10,6 +12,7 @@
1012

1113
from cache_helper import utils
1214

15+
logger = logging.getLogger(__name__)
1316

1417
def cached(timeout):
1518
def _cached(func):
@@ -34,7 +37,10 @@ def wrapper(*args, **kwargs):
3437
cache.set(cache_key, value, timeout)
3538

3639
except CacheSetError:
37-
pass
40+
logger.warning(
41+
f'Error saving value to Cache for Key: {cache_key}',
42+
exc_info=True,
43+
)
3844

3945
return value
4046

@@ -81,7 +87,10 @@ def wrapper(*args, **kwargs):
8187
try:
8288
cache.set(cache_key, value, timeout)
8389
except CacheSetError:
84-
pass
90+
logger.warning(
91+
f'Error saving value to Cache for Key: {cache_key}',
92+
exc_info=True,
93+
)
8594

8695
return value
8796

@@ -145,7 +154,10 @@ def __call__(self, *args, **kwargs):
145154
try:
146155
cache.set(cache_key, value, timeout)
147156
except CacheSetError:
148-
pass
157+
logger.warning(
158+
f'Error saving value to Cache for Key: {cache_key}',
159+
exc_info=True,
160+
)
149161
return value
150162

151163
def _invalidate(self, *args, **kwargs):

0 commit comments

Comments
 (0)