# HG changeset patch # User Marcin Cieślak # Date 1430789590 0 # Tue May 05 01:33:10 2015 +0000 # Node ID f5d66045fef6e51326fbadb2bc26b28b7c1da9a4 # Parent ab1594e6fc2596e654929f2eb60548f385eb949f Add python logging, re-enable meta diff --git a/meta/kursy/tabelac.py b/meta/kursy/tabelac.py --- a/meta/kursy/tabelac.py +++ b/meta/kursy/tabelac.py @@ -1,4 +1,3 @@ - # -*- encoding: utf-8 import feedparser import xml.dom.minidom as dom @@ -7,6 +6,12 @@ import currencytemplate, tabelakursow from decimal import * import wikipedia +import logging +import logging.config + +logging.config.fileConfig("/home/saper/wikipedia/log/bots.conf", disable_existing_loggers=True) +wikipedia.logger = logging.getLogger('plwiki') +mylogger = logging.getLogger('kursywalut') meta = wikipedia.getSite("meta", "meta", "KursyWalut") wikinews = wikipedia.getSite("pl", "wikinews", "KursyWalut") @@ -50,8 +55,7 @@ parsed = dom.parseString(content) if old_uid != get_uid(parsed): - print "Old uid: %s" % old_uid - print "New uid: %s" % get_uid(parsed) + mylogger.info("Kursy walut: uid: %s->%s" % (old_uid, get_uid(parsed))) data_publikacji = parsed.getElementsByTagName("data_publikacji")[0].firstChild.nodeValue if localfile: wr = open(localfile, "w") @@ -87,12 +91,12 @@ # (site, pagename, lastmod, comment, table, pagetext ) strony_tabeli_c = [ -# (meta, u"User:KursyWalut/CurrencyTable", True, TABLEACTIONMSG, tabelac, -# tabelakursow.tabela), + (meta, u"User:KursyWalut/CurrencyTable", True, TABLEACTIONMSG, tabelac, + tabelakursow.tabela), (wikinews, u"Szablon:Kursy walut", True, TABLEACTIONMSG, tabelac, tabelakursow.tabelawikinews), -# (meta, u"Template:PLNConvert", False, TEMPLATEACTIONMSG, tabelac, -# currencytemplate.tabela), + (meta, u"Template:PLNConvert", False, TEMPLATEACTIONMSG, tabelac, + currencytemplate.tabela), (wikinews, u"Szablon:PLNConvert", False, TEMPLATEACTIONMSG, tabelac, currencytemplate.tabela), ] diff --git a/plwiki/chemia/comp.py b/plwiki/chemia/comp.py --- a/plwiki/chemia/comp.py +++ b/plwiki/chemia/comp.py @@ -6,6 +6,13 @@ from element import ElementSet +import logging +import logging.config + +logging.config.fileConfig("/home/saper/wikipedia/log/bots.conf", disable_existing_loggers=True) +wikipedia.logger = logging.getLogger('plwiki') +mywiki = logging.getLogger('chemia') + MAINPAGENAME = u"Wikipedysta:Miner/Związki chemiczne według pierwiastków" MAINTEMPLATENAME =u"Szablon:Związek chemiczny infobox" @@ -159,6 +166,7 @@ errpage.put(u"".join(badlist), comment=u"Robot zapisuje błędy wynikłe podczas tworzenia [[%s]]" % MAINPAGENAME, minorEdit=False, botflag=False) + mywiki.info(u"Pierwiastki zostały przetworzone") def processcompfile(elements, compfile=None):