Skip to content

Commit 318e1f4

Browse files
committed
Empty implementation for logging from LUA with redis.log.
1 parent b59da64 commit 318e1f4

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

mockredis/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1551,6 +1551,9 @@ def _encode(self, value):
15511551
value = value.encode('utf-8', 'strict')
15521552
return value
15531553

1554+
def _log(self, level, msg):
1555+
pass
1556+
15541557

15551558
def get_total_milliseconds(td):
15561559
return int((td.days * 24 * 60 * 60 + td.seconds) * 1000 + td.microseconds / 1000.0)

mockredis/script.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import logging
12
import sys
23
import threading
34
try:
@@ -61,7 +62,12 @@ def _call(*call_args):
6162
lua_globals.redis = {"call": _call,
6263
# TODO wrap _call with try to implement "pcall": _pcall,
6364
"status_reply": lambda status: self._python_to_lua({"ok": status}),
64-
"error_reply": lambda error: self._python_to_lua({"err": error})
65+
"error_reply": lambda error: self._python_to_lua({"err": error}),
66+
"log": client._log,
67+
"LOG_DEBUG": logging.DEBUG,
68+
"LOG_VERBOSE": logging.INFO,
69+
"LOG_NOTICE": logging.WARNING,
70+
"LOG_WARNING": logging.ERROR
6571
}
6672
return self._lua_to_python(lua.execute(self.script), return_status=True)
6773

0 commit comments

Comments
 (0)