Skip to content

Commit db83c8f

Browse files
authored
Merge pull request realpython#798 from userlerueda/patch-1
Update logging.rst
2 parents a0b6fc8 + f20a2f6 commit db83c8f

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

docs/writing/logging.rst

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,8 @@ this in your ``__init__.py``
5555

5656
.. code-block:: python
5757
58-
# Set default logging handler to avoid "No handler found" warnings.
5958
import logging
60-
try: # Python 2.7+
61-
from logging import NullHandler
62-
except ImportError:
63-
class NullHandler(logging.Handler):
64-
def emit(self, record):
65-
pass
66-
67-
logging.getLogger(__name__).addHandler(NullHandler())
68-
59+
logging.getLogger(__name__).addHandler(logging.NullHandler())
6960
7061
7162
Logging in an Application

0 commit comments

Comments
 (0)