Skip to content

Commit dd88d2b

Browse files
committed
Move NullHandler to .compat
1 parent f42899c commit dd88d2b

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

retry/__init__.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,9 @@
33
import logging
44

55
from .api import retry, retry_call
6+
from .compat import NullHandler
67

78

89
# Set default logging handler to avoid "No handler found" warnings.
9-
try: # Python 2.7+
10-
from logging import NullHandler
11-
except ImportError:
12-
class NullHandler(logging.Handler):
13-
14-
def emit(self, record):
15-
pass
16-
1710
log = logging.getLogger(__name__)
1811
log.addHandler(NullHandler())

retry/compat.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import functools
2+
import logging
23

34

45
try:
@@ -16,3 +17,12 @@ def wrapper(*args, **kwargs):
1617
return caller(f, *args, **kwargs)
1718
return wrapper
1819
return decor
20+
21+
22+
try: # Python 2.7+
23+
from logging import NullHandler
24+
except ImportError:
25+
class NullHandler(logging.Handler):
26+
27+
def emit(self, record):
28+
pass

0 commit comments

Comments
 (0)