From 6769a742deb8970c0fbee44546224a79ee9b41ef Mon Sep 17 00:00:00 2001 From: Robin Wittler Date: Wed, 3 Aug 2011 14:27:11 +0200 Subject: [PATCH] change log behavior --- testgit_build.py | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/testgit_build.py b/testgit_build.py index 1544b7f..8f5dfe6 100755 --- a/testgit_build.py +++ b/testgit_build.py @@ -62,13 +62,26 @@ SMTP_BUILD_SUCCESS = 'SUCCESSFULL' SMTP_BUILD_ERROR = 'NOT SUCCESSFULL' SMTP_FROM = '%s@profitbricks.com' %(pwd.getpwuid(os.geteuid()).pw_name) -logger = logging.getLogger(sys.argv[0]) +#logger = logging.getLogger(sys.argv[0]) +#logger.setLevel(logging.DEBUG) +#stream_handler = logging.StreamHandler() +#stream_handler.setLevel(logging.DEBUG) +#formatter = Formatter('%(asctime)s %(name)s[%(process)d] %(levelname)s: %(message)s') +#stream_handler.setFormatter(formatter) +#logger.addHandler(stream_handler) + +log_format = '%(asctime)s %(name)s[%(process)d] %(levelname)s: %(message)s' +formatter = Formatter(log_format) +logging.basicConfig( + format=log_format, + level=logging.DEBUG +) +logger = logging.getLogger(__file__) logger.setLevel(logging.DEBUG) -stream_handler = logging.StreamHandler() -stream_handler.setLevel(logging.DEBUG) -formatter = Formatter('%(asctime)s %(name)s[%(process)d] %(levelname)s: %(message)s') -stream_handler.setFormatter(formatter) -logger.addHandler(stream_handler) +#stream_handler = logging.StreamHandler() +#stream_handler.setLevel(logging.DEBUG) +#stream_handler.setFormatter(formatter) +#logger.addHandler(stream_handler) def send_email(result): smtp = smtplib.SMTP(SMTP_SERVER) -- 2.39.5