You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/11/07 22:32:37 UTC
[GitHub] srkukarni closed pull request #2944: Make Log a logger instead of
Logger Adapter
srkukarni closed pull request #2944: Make Log a logger instead of Logger Adapter
URL: https://github.com/apache/pulsar/pull/2944
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/pulsar-functions/instance/src/main/python/log.py b/pulsar-functions/instance/src/main/python/log.py
index 4eb02c8791..f8ee10c8e5 100644
--- a/pulsar-functions/instance/src/main/python/log.py
+++ b/pulsar-functions/instance/src/main/python/log.py
@@ -26,7 +26,6 @@
import logging.handlers
import os
import errno
-from logging.handlers import RotatingFileHandler
import pulsar
# Create the logger
@@ -72,25 +71,6 @@ def __init__(self, filename, mode='a', maxBytes=10 * 1024 * 1024, backupCount=5,
mkdir_p(os.path.dirname(filename))
logging.handlers.RotatingFileHandler.__init__(self, filename, mode=mode, maxBytes=maxBytes, backupCount=backupCount, encoding=encoding, delay=delay)
-def configure(level=logging.INFO):
- """ Configure logger which dumps log on terminal
-
- :param level: logging level: info, warning, verbose...
- :type level: logging level
- :type logfile: string
- :return: None
- :rtype: None
- """
-
- # Remove all the existing StreamHandlers to avoid duplicate
- for handler in Log.handlers:
- if isinstance(handler, logging.StreamHandler):
- Log.handlers.remove(handler)
-
- Log.setLevel(level)
- stream_handler = logging.StreamHandler()
- add_handler(stream_handler)
-
def remove_all_handlers():
retval = None
for handler in Log.handlers:
@@ -110,17 +90,5 @@ def init_logger(level, logfile, logging_config_file):
os.environ['LOG_FILE'] = logfile;
logging.config.fileConfig(logging_config_file)
Log = logging.getLogger()
- Log = logging.LoggerAdapter(Log, {'level': level})
-
-def set_logging_level(cl_args):
- """simply set verbose level based on command-line args
+ Log.setLevel(level)
- :param cl_args: CLI arguments
- :type cl_args: dict
- :return: None
- :rtype: None
- """
- if 'verbose' in cl_args and cl_args['verbose']:
- configure(logging.DEBUG)
- else:
- configure(logging.INFO)
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services