Legoktm has uploaded a new change for review.
https://gerrit.wikimedia.org/r/82113
Change subject: Implement logging
......................................................................
Implement logging
Change-Id: I25b92de9a9590ae57c8204e99171a4e0fdc66b00
---
M bz.py
M main.py
2 files changed, 20 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/pywikibot/sf-export
refs/changes/13/82113/1
diff --git a/bz.py b/bz.py
index 7fced3b..7bf3a0e 100644
--- a/bz.py
+++ b/bz.py
@@ -3,6 +3,8 @@
Stuff to import into bugzilla with
"""
+import logging
+
def create_bug(BZ, ticket):
"""
@@ -23,6 +25,7 @@
'description': ticket.export(),
'status': '', # Need to map this
}
+ logging.info('Uploading {0} to Bugzilla'.format(ticket.human_url()))
bug = BZ.createbug(**params)
# Now add all the comments.
diff --git a/main.py b/main.py
index 06ecea4..b95ecbd 100644
--- a/main.py
+++ b/main.py
@@ -10,10 +10,27 @@
* Leave a comment on the sf ticket with a link to the bugzilla bug
"""
+import logging
import bugzilla
import sf
import bz
+logger = logging.getLogger()
+logger.setLevel(logging.DEBUG)
+formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s')
+
+# Log to a file
+fh = logging.FileHandler('sf-export.log')
+fh.setLevel(logging.DEBUG)
+fh.setFormatter(formatter)
+logger.addHandler(fh)
+
+# Also print log messages
+ch = logging.StreamHandler()
+ch.setLevel(logging.DEBUG)
+ch.setFormatter(formatter)
+logger.addHandler(ch)
+
b = bugzilla.Bugzilla(
url='https://bugzilla.wikimedia.org/xmlrpc.cgi',
user='blah',
--
To view, visit https://gerrit.wikimedia.org/r/82113
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I25b92de9a9590ae57c8204e99171a4e0fdc66b00
Gerrit-PatchSet: 1
Gerrit-Project: pywikibot/sf-export
Gerrit-Branch: master
Gerrit-Owner: Legoktm <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits