No logging.NullHandler in P2.5, switch grangerenchanted from StoneSoup.

This commit is contained in:
Jim Miller
2012-10-16 11:04:10 -05:00
parent a0f16425d2
commit 668fc7a211
3 changed files with 19 additions and 17 deletions
+8 -7
View File
@@ -15,13 +15,6 @@
# limitations under the License.
#
import logging
# suppresses default logger. Logging is setup in fanficdownload/__init__.py so it works in calibre, too.
logger = logging.getLogger()
loghandler=logging.NullHandler()
loghandler.setFormatter(logging.Formatter("(=====)(levelname)s:%(message)s"))
logger.addHandler(loghandler)
import sys, os
from os.path import normpath, expanduser, isfile, join
from StringIO import StringIO
@@ -31,6 +24,14 @@ import string
import ConfigParser
from subprocess import call
import logging
if sys.version_info >= (2, 7):
# suppresses default logger. Logging is setup in fanficdownload/__init__.py so it works in calibre, too.
rootlogger = logging.getLogger()
loghandler=logging.NullHandler()
loghandler.setFormatter(logging.Formatter("(=====)(levelname)s:%(message)s"))
rootlogger.addHandler(loghandler)
from fanficdownloader import adapters,writers,exceptions
from fanficdownloader.configurable import Configuration
from fanficdownloader.epubutils import get_dcsource_chaptercount, get_update_data
+9 -8
View File
@@ -4,12 +4,13 @@ try:
# just a way to switch between web service and CLI/PI
import google.appengine.api
except:
import logging
logger = logging.getLogger(__name__)
loghandler=logging.StreamHandler()
loghandler.setFormatter(logging.Formatter("FFDL:%(levelname)s:%(filename)s(%(lineno)d):%(message)s"))
logger.addHandler(loghandler)
loghandler.setLevel(logging.DEBUG)
logger.setLevel(logging.DEBUG)
import sys
if sys.version_info >= (2, 7):
import logging
logger = logging.getLogger(__name__)
loghandler=logging.StreamHandler()
loghandler.setFormatter(logging.Formatter("FFDL:%(levelname)s:%(filename)s(%(lineno)d):%(message)s"))
logger.addHandler(loghandler)
loghandler.setLevel(logging.DEBUG)
logger.setLevel(logging.DEBUG)
@@ -287,8 +287,8 @@ class GrangerEnchantedCom(BaseSiteAdapter):
logger.debug('Getting chapter text from: %s' % url)
soup = bs.BeautifulStoneSoup(self._fetchUrl(url),
selfClosingTags=('br','hr')) # otherwise soup eats the br/hr tags.
soup = bs.BeautifulSoup(self._fetchUrl(url),
selfClosingTags=('br','hr')) # otherwise soup eats the br/hr tags.
div = soup.find('div', {'id' : 'story1'})