Commit 8a88bb291064a49a7d6287b9925957ca64fa0639
1 parent
efa4ad19
olevba: removed NullHandler (was only needed for Python 2.6)
Showing
1 changed file
with
1 additions
and
11 deletions
oletools/olevba.py
| @@ -360,16 +360,6 @@ if sys.version_info >= (3, 0) and sys.version_info < (3, 5): | @@ -360,16 +360,6 @@ if sys.version_info >= (3, 0) and sys.version_info < (3, 5): | ||
| 360 | 360 | ||
| 361 | # === LOGGING ================================================================= | 361 | # === LOGGING ================================================================= |
| 362 | 362 | ||
| 363 | -class NullHandler(logging.Handler): | ||
| 364 | - """ | ||
| 365 | - Log Handler without output, to avoid printing messages if logging is not | ||
| 366 | - configured by the main application. | ||
| 367 | - Python 2.7 has logging.NullHandler, but this is necessary for 2.6: | ||
| 368 | - see https://docs.python.org/2.6/library/logging.html#configuring-logging-for-a-library | ||
| 369 | - """ | ||
| 370 | - def emit(self, record): | ||
| 371 | - pass | ||
| 372 | - | ||
| 373 | def get_logger(name, level=logging.CRITICAL+1): | 363 | def get_logger(name, level=logging.CRITICAL+1): |
| 374 | """ | 364 | """ |
| 375 | Create a suitable logger object for this module. | 365 | Create a suitable logger object for this module. |
| @@ -392,7 +382,7 @@ def get_logger(name, level=logging.CRITICAL+1): | @@ -392,7 +382,7 @@ def get_logger(name, level=logging.CRITICAL+1): | ||
| 392 | logger = logging.getLogger(name) | 382 | logger = logging.getLogger(name) |
| 393 | # only add a NullHandler for this logger, it is up to the application | 383 | # only add a NullHandler for this logger, it is up to the application |
| 394 | # to configure its own logging: | 384 | # to configure its own logging: |
| 395 | - logger.addHandler(NullHandler()) | 385 | + logger.addHandler(logging.NullHandler()) |
| 396 | logger.setLevel(level) | 386 | logger.setLevel(level) |
| 397 | return logger | 387 | return logger |
| 398 | 388 |