Scrapy, a fast high-level web crawling & scraping framework for Python.
some minor adjustments to logging doc
Pablo Hoffman9dc7a3a37318
diff --git a/docs/topics/logging.rst b/docs/topics/logging.rstindex f0d6d3bc6..b9ab1d133 100644--- a/docs/topics/logging.rst+++ b/docs/topics/logging.rst@@ -66,17 +66,20 @@ scrapy.log moduleStart the logging facility. This must be called before actually logging anymessages. Otherwise, messages logged before this call will get lost.- ``logfile`` is a string with the file path to use for logging output. If- omitted, :setting:`LOG_FILE` setting will be used. If both are ``None``, log- will be sent to standard output (if ``logstdout`` or :setting:`LOG_STDOUT` is- ``True``) or standard error (if ``log_stderr`` or :setting:`LOG_STDOUT` is- ``False``).-- ``loglevel`` is the logging level. Availables ones are: :data:`CRITICAL`,- :data:`ERROR`, :data:`WARNING`, :data:`INFO` and :data:`DEBUG`.-- ``log_stdout`` is a boolean which specifies if log should be sent to standard- output (if ``True``) or standard error (if ``False``)+ :param logfile: the file path to use for logging output. If omitted, the+ :setting:`LOG_FILE` setting will be used. If both are ``None``, the log+ will be sent to standard error.+ :type logfile: str++ :param loglevel: the minimum logging level to log. Availables values are:+ :data:`CRITICAL`, :data:`ERROR`, :data:`WARNING`, :data:`INFO` and+ :data:`DEBUG`.++ :param logstdout: if ``True``, all standard output (and error) of your+ application will be logged instead. For example if you "print 'hello'"+ it will appear in the Scrapy log. If ommited, the :setting:`LOG_STDOUT`+ setting will be used.+ :type logstdout: boolean.. function:: msg(message, level=INFO, component=BOT_NAME, domain=None)diff --git a/scrapy/log.py b/scrapy/log.pyindex d36d0cf88..f2d9c16e6 100644--- a/scrapy/log.py+++ b/scrapy/log.py@@ -50,7 +50,8 @@ def start(logfile=None, loglevel=None, logstdout=None):# set log observerif log.defaultObserver: # check twisted log not already startedlogfile = logfile or settings['LOG_FILE'] or settings['LOGFILE']- logstdout = logstdout or settings.getbool('LOG_STDOUT')+ if logstdout is None:+ logstdout = settings.getbool('LOG_STDOUT')file = open(logfile, 'a') if logfile else sys.stderrlog.startLogging(file, setStdout=logstdout)