]> Frank Brehm's Git Trees - profitbricks/jenkins-build-scripts.git/commitdiff
provide logging too
authorHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 10:59:07 +0000 (11:59 +0100)
committerHolger Levsen <holger@layer-acht.org>
Wed, 2 Nov 2011 10:59:07 +0000 (11:59 +0100)
kernel_build.py
kernel_persistence.py

index b9b6eec6aacf10d605464ebb63d2e16eb7ee2733..f94e027326f2c08f0e49a43420d22771e51a3f6e 100644 (file)
@@ -43,6 +43,7 @@ env['PB_SUITE'] = os.environ.get('DISTRIBUTION')
 if os.environ.get('DISTRIBUTION') == 'production':
     env['PB_SUITE'] = 'production-proposed-updates'
 
+# FIXME: move this into own logger Class
 logger = logging.getLogger(sys.argv[0])
 logger.setLevel(logging.DEBUG)
 stream_handler = logging.StreamHandler()
index b5542ae938628b4219e7a86ca15f0e1098f14751..3d72aded4bb28d024814a0d9b2a8b39f3ddd987f 100644 (file)
@@ -7,6 +7,8 @@ from sqlalchemy.orm import sessionmaker
 from sqlalchemy import Table, Column, Integer, String, MetaData, Sequence
 from sqlalchemy.ext.declarative import declarative_base
 from sqlalchemy.orm.exc import NoResultFound
+import logging
+from logging import Formatter
 
 CWD = os.environ.get('WORKSPACE')
 PERSISTENCE_FILE = os.path.join(CWD, '..', '.persistence')
@@ -16,6 +18,15 @@ engine = create_engine('sqlite:///%s' %(PERSISTENCE_FILE))
 Session = sessionmaker(bind=engine)
 Base.metadata.create_all(engine)
 
+# FIXME: move this into own logger Class
+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)
+
 class KernelVersion(Base):
     __tablename__ = 'branch_kernel_version'
     id = Column(Integer, Sequence('branch_id'), primary_key=True)