Hello community, here is the log from the commit of package python-logutils for openSUSE:Factory checked in at 2017-07-11 08:25:00 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-logutils (Old) and /work/SRC/openSUSE:Factory/.python-logutils.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-logutils" Tue Jul 11 08:25:00 2017 rev:4 rq:507970 version:0.3.5 Changes: -------- --- /work/SRC/openSUSE:Factory/python-logutils/python-logutils.changes 2013-07-18 18:08:32.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-logutils.new/python-logutils.changes 2017-07-11 08:25:01.390405657 +0200 @@ -1,0 +2,13 @@ +Thu Jun 29 16:53:49 UTC 2017 - [email protected] + +- update to 0.3.5: + - Bring QueueListener implementation in line with the version in the stdlib. + - Fixed a bug in ColorizingStreamHandler relating to encoding. + - Return non-zero error code from "setup.py test" when a test fails. + - Make the dictConfig tests work with both Python 2.x and 3.x. +- convert to singlespec +- fix Source url +- split -doc package +- update Url + +------------------------------------------------------------------- Old: ---- logutils-0.3.3.tar.gz New: ---- logutils-0.3.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-logutils.spec ++++++ --- /var/tmp/diff_new_pack.drXqCg/_old 2017-07-11 08:25:01.958325556 +0200 +++ /var/tmp/diff_new_pack.drXqCg/_new 2017-07-11 08:25:01.958325556 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-logutils # -# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -13,25 +13,26 @@ # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ +# +%{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-logutils -Version: 0.3.3 +Version: 0.3.5 Release: 0 -License: BSD-3-Clause Summary: Logging utilities -Url: http://code.google.com/p/logutils/ +License: BSD-3-Clause Group: Development/Languages/Python -Source: https://pypi.python.org/packages/source/l/logutils/logutils-%{version}.tar.gz -BuildRequires: python-devel -# Documentation requirements: -BuildRequires: python-Sphinx +Url: https://logutils.readthedocs.io/ +Source: https://files.pythonhosted.org/packages/source/l/logutils/logutils-%{version}.tar.gz +BuildRequires: %{python_module devel} +BuildRequires: %{python_module setuptools} +BuildRequires: python-rpm-macros +BuildRequires: python3-Sphinx BuildRoot: %{_tmppath}/%{name}-%{version}-build -%if 0%{?suse_version} && 0%{?suse_version} <= 1110 -%{!?python_sitelib: %global python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%else BuildArch: noarch -%endif + +%python_subpackages %description The logutils package provides a set of handlers for the Python standard @@ -42,22 +43,41 @@ appeared in recent Python releases, but are usable with older versions of Python and so are packaged here. +%package -n python-logutils-doc +Summary: Documentation for %{name} +Group: Documentation/Other +Provides: %{python_module logutils-doc = %{version}} + +%description -n python-logutils-doc +The logutils package provides a set of handlers for the Python standard +library's logging package. + +Some of these handlers are out-of-scope for the standard library, and +so they are packaged here. Others are updated versions which have +appeared in recent Python releases, but are usable with older versions +of Python and so are packaged here. + +This package contains the documentation. + %prep %setup -q -n logutils-%{version} %build -python setup.py build +%python_build cd doc && make html %install -python setup.py install --prefix=%{_prefix} --root=%{buildroot} +%python_install %check -python setup.py test +%python_exec setup.py test -%files +%files %{python_files} %defattr(-,root,root,-) -%doc LICENSE.txt NEWS.txt README.txt doc/_build/html +%doc LICENSE.txt NEWS.txt README.rst %{python_sitelib}/* +%files -n python-logutils-doc +%doc LICENSE.txt doc/_build/html + %changelog ++++++ logutils-0.3.3.tar.gz -> logutils-0.3.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/LICENSE.txt new/logutils-0.3.5/LICENSE.txt --- old/logutils-0.3.3/LICENSE.txt 2013-01-24 13:36:03.000000000 +0100 +++ new/logutils-0.3.5/LICENSE.txt 2017-02-20 18:37:15.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 2008-2013 by Vinay Sajip. +Copyright (c) 2008-2017 by Vinay Sajip. All rights reserved. Redistribution and use in source and binary forms, with or without diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/NEWS.txt new/logutils-0.3.5/NEWS.txt --- old/logutils-0.3.3/NEWS.txt 2013-01-24 13:37:21.000000000 +0100 +++ new/logutils-0.3.5/NEWS.txt 2017-06-24 16:47:09.000000000 +0200 @@ -5,6 +5,18 @@ What's New in logutils ====================== +Version 0.3.5 +------------- + +- Bring QueueListener implementation in line with the version in the stdlib. +- Fixed a bug in ColorizingStreamHandler relating to encoding. + +Version 0.3.4 +------------- + +- Return non-zero error code from "setup.py test" when a test fails. +- Make the dictConfig tests work with both Python 2.x and 3.x. + Version 0.3.3 ------------- @@ -14,10 +26,8 @@ ------------- - Improvements in QueueListener implementation. -- Added redis module with RedisQueueHandler and - RedisQueueListener. -- Added unit test for a handler in a module - where absolute imports are used. +- Added redis module with RedisQueueHandler and RedisQueueListener. +- Added unit test for a handler in a module where absolute imports are used. Version 0.3.1 ------------- diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/PKG-INFO new/logutils-0.3.5/PKG-INFO --- old/logutils-0.3.3/PKG-INFO 2013-01-24 13:53:15.000000000 +0100 +++ new/logutils-0.3.5/PKG-INFO 2017-06-24 21:54:46.000000000 +0200 @@ -1,11 +1,11 @@ -Metadata-Version: 1.0 +Metadata-Version: 1.1 Name: logutils -Version: 0.3.3 +Version: 0.3.5 Summary: Logging utilities Home-page: http://code.google.com/p/logutils/ Author: Vinay Sajip Author-email: [email protected] -License: Copyright (C) 2010-2013 by Vinay Sajip. All Rights Reserved. See LICENSE.txt for license. +License: Copyright (C) 2010-2017 by Vinay Sajip. All Rights Reserved. See LICENSE.txt for license. Description: The logutils package provides a set of handlers for the Python standard library's logging package. @@ -14,10 +14,15 @@ appeared in recent Python releases, but are usable with older versions of Python and so are packaged here. - The latest version of logutils can be found at: + The source code repository is at: - http://code.google.com/p/logutils/ + https://bitbucket.org/vinay.sajip/logutils/ + Documentation is available at: + + https://logutils.readthedocs.io/ + + https://pythonhosted.org/logutils/ Platform: UNKNOWN Classifier: Development Status :: 5 - Production/Stable diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/README.rst new/logutils-0.3.5/README.rst --- old/logutils-0.3.3/README.rst 1970-01-01 01:00:00.000000000 +0100 +++ new/logutils-0.3.5/README.rst 2017-02-20 19:22:08.000000000 +0100 @@ -0,0 +1,41 @@ +.. image:: https://travis-ci.org/vsajip/logutils.svg + :target: https://travis-ci.org/vsajip/logutils + +.. image:: https://coveralls.io/repos/vsajip/logutils/badge.svg + :target: https://coveralls.io/github/vsajip/logutils + +logutils 0.3.4 +============== +The logutils package provides a set of handlers for the Python standard +library's logging package. + +Some of these handlers are out-of-scope for the standard library, and +so they are packaged here. Others are updated versions which have +appeared in recent Python releases, but are usable with older versions +of Python and so are packaged here. + +Requirements & Installation +--------------------------- +The logutils package requires Python 2.5 or greater, and can be +installed with the standard Python installation procedure: + + python setup.py install + +There is a set of unit tests which you can invoke with + + python setup.py test + +before running the installation. + +Availability & Documentation +---------------------------- + +The source code repository is at: + +https://bitbucket.org/vinay.sajip/logutils/ + +Documentation is available at: + +https://logutils.readthedocs.io/ + +https://pythonhosted.org/logutils/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/README.txt new/logutils-0.3.5/README.txt --- old/logutils-0.3.3/README.txt 2013-01-24 13:35:46.000000000 +0100 +++ new/logutils-0.3.5/README.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,29 +0,0 @@ -logutils 0.3.3 -============== -The logutils package provides a set of handlers for the Python standard -library's logging package. - -Some of these handlers are out-of-scope for the standard library, and -so they are packaged here. Others are updated versions which have -appeared in recent Python releases, but are usable with older versions -of Python and so are packaged here. - -Requirements & Installation ---------------------------- -The logutils package requires Python 2.5 or greater, and can be -installed with the standard Python installation procedure: - - python setup.py install - -There is a set of unit tests which you can invoke with - - python setup.py test - -before running the installation. - -Availability & Documentation ----------------------------- -The latest version of logutils can be found at: - - http://code.google.com/p/logutils/ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/doc/conf.py new/logutils-0.3.5/doc/conf.py --- old/logutils-0.3.3/doc/conf.py 2013-01-24 13:38:59.000000000 +0100 +++ new/logutils-0.3.5/doc/conf.py 2017-02-20 21:48:48.000000000 +0100 @@ -42,7 +42,7 @@ # General information about the project. project = u'Logutils' -copyright = u'2010-2013, Vinay Sajip' +copyright = u'2010-2017, Vinay Sajip' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -51,7 +51,7 @@ # The short X.Y version. version = '0.3' # The full version, including alpha/beta/rc tags. -release = '0.3.3' +release = '0.3.5' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -94,7 +94,7 @@ # The style sheet to use for HTML and HTML Help pages. A file of that name # must exist either in Sphinx' static/ path, or in one of the custom paths # given in html_static_path. -html_style = 'default.css' +# html_style = 'default.css' # The name for this set of Sphinx documents. If None, it defaults to # "<project> v<release> documentation". @@ -115,7 +115,7 @@ # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. @@ -152,6 +152,9 @@ # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = '' +html_theme = os.environ.get('DOCS_THEME', 'alabaster') +html_theme_path = ['themes'] + # Output file base name for HTML help builder. htmlhelp_basename = 'Logutilsdoc' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/logutils/__init__.py new/logutils-0.3.5/logutils/__init__.py --- old/logutils-0.3.3/logutils/__init__.py 2013-01-24 13:50:15.000000000 +0100 +++ new/logutils-0.3.5/logutils/__init__.py 2017-02-20 21:48:48.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2010-2017 Vinay Sajip. See LICENSE.txt for details. # """ The logutils package provides a set of handlers for the Python standard @@ -13,7 +13,7 @@ import logging from string import Template -__version__ = '0.3.3' +__version__ = '0.3.5' class NullHandler(logging.Handler): """ @@ -29,7 +29,7 @@ def handle(self, record): """ Handle a record. Does nothing in this class, but in other - handlers it typically filters and then emits the record in a + handlers it typically filters and then emits the record in a thread-safe way. """ pass @@ -160,7 +160,7 @@ self.args = args self.kwargs = kwargs self.str = None - + def __str__(self): if self.str is None: self.str = self.fmt.format(*self.args, **self.kwargs) @@ -171,7 +171,7 @@ self.fmt = fmt self.kwargs = kwargs self.str = None - + def __str__(self): if self.str is None: self.str = Template(self.fmt).substitute(**self.kwargs) @@ -192,4 +192,3 @@ else: logger = logger.parent return rv - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/logutils/adapter.py new/logutils-0.3.5/logutils/adapter.py --- old/logutils-0.3.3/logutils/adapter.py 2013-01-24 13:48:19.000000000 +0100 +++ new/logutils-0.3.5/logutils/adapter.py 2017-02-20 18:39:56.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2010-2017 Vinay Sajip. See LICENSE.txt for details. # import logging import logutils @@ -113,4 +113,3 @@ See if the underlying logger has any handlers. """ return logutils.hasHandlers(self.logger) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/logutils/colorize.py new/logutils-0.3.5/logutils/colorize.py --- old/logutils-0.3.3/logutils/colorize.py 2013-01-24 13:40:19.000000000 +0100 +++ new/logutils-0.3.5/logutils/colorize.py 2017-02-22 07:30:08.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2013 Vinay Sajip. All rights reserved. +# Copyright (C) 2010-2017 Vinay Sajip. All rights reserved. # import ctypes import logging @@ -18,7 +18,7 @@ :param strm: The stream to colorize - typically ``sys.stdout`` or ``sys.stderr``. """ - + # color names to indices color_map = { 'black': 0, @@ -64,7 +64,8 @@ message = self.format(record) stream = self.stream if unicode and isinstance(message, unicode): - enc = getattr(stream, 'encoding', 'utf-8') + # Sometimes there's an encoding attribute, but it's None. + enc = getattr(stream, 'encoding', None) or 'utf-8' message = message.encode(enc, 'replace') if not self.is_tty: stream.write(message) @@ -191,4 +192,3 @@ parts[0] = self.colorize(parts[0], record) message = '\n'.join(parts) return message - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/logutils/dictconfig.py new/logutils-0.3.5/logutils/dictconfig.py --- old/logutils-0.3.3/logutils/dictconfig.py 2013-01-24 13:50:52.000000000 +0100 +++ new/logutils-0.3.5/logutils/dictconfig.py 2017-02-20 18:37:54.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2009-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2009-2017 Vinay Sajip. See LICENSE.txt for details. # import logging.handlers import re @@ -14,7 +14,7 @@ StandardError except NameError: StandardError = Exception - + IDENTIFIER = re.compile('^[a-z_][a-z0-9_]*$', re.I) def valid_ident(s): @@ -33,9 +33,13 @@ if isinstance(level, int): rv = level elif str(level) == level: - if level not in logging._levelNames: + try: + levelnames = logging._levelNames + except AttributeError: + levelnames = logging._nameToLevel + if level not in levelnames: raise ValueError('Unknown level: %r' % level) - rv = logging._levelNames[level] + rv = levelnames[level] else: raise TypeError('Level not an integer or a ' 'valid string: %r' % level) @@ -64,7 +68,7 @@ result.parent = self result.key = key return result - + def get(self, key, default=None): value = dict.get(self, key, default) result = self.configurator.convert(value) @@ -76,7 +80,7 @@ result.parent = self result.key = key return result - + def pop(self, key, default=None): value = dict.pop(self, key, default) result = self.configurator.convert(value) @@ -126,7 +130,7 @@ """ The configurator base class which defines some useful defaults. """ - + CONVERT_PATTERN = re.compile(r'^(?P<prefix>[a-z]+)://(?P<suffix>.*)$') WORD_PATTERN = re.compile(r'^\s*(\w+)\s*') @@ -177,7 +181,7 @@ def ext_convert(self, value): """Default converter for the ext:// protocol.""" return self.resolve(value) - + def cfg_convert(self, value): """Default converter for the cfg:// protocol.""" rest = value @@ -239,7 +243,7 @@ converter = getattr(self, converter) value = converter(suffix) return value - + def configure_custom(self, config): """Configure an object with a user-supplied factory.""" c = config.pop('()') @@ -269,7 +273,7 @@ else: result = (major > 3) return result - + class DictConfigurator(BaseConfigurator): """ Configure logging using a dictionary-like object to describe the @@ -326,10 +330,10 @@ 'logger: %s' % e) else: disable_existing = config.pop('disable_existing_loggers', True) - + logging._handlers.clear() del logging._handlerList[:] - + # Do formatters first - they don't refer to anything else formatters = config.get('formatters', EMPTY_DICT) for name in formatters: @@ -364,7 +368,7 @@ raise ValueError('Unable to configure handler ' '%r: %s' % (name, e)) # Next, do loggers - they refer to handlers and filters - + #we don't want to lose the existing loggers, #since other threads may have pointers to them. #existing is set to contain all existing loggers, @@ -402,7 +406,7 @@ e = sys.exc_info()[1] raise ValueError('Unable to configure logger ' '%r: %s' % (name, e)) - + #Disable any old loggers. There's no point deleting #them as other threads may continue to hold references #and by disabling them, you stop them doing any logging. @@ -416,12 +420,12 @@ logger.propagate = True elif disable_existing: logger.disabled = True - + # And finally, do the root logger root = config.get('root', None) if root: try: - self.configure_root(root) + self.configure_root(root) except StandardError: e = sys.exc_info()[1] raise ValueError('Unable to configure root ' @@ -451,7 +455,7 @@ dfmt = config.get('datefmt', None) result = logging.Formatter(fmt, dfmt) return result - + def configure_filter(self, config): """Configure a filter from a dictionary.""" if '()' in config: @@ -552,7 +556,7 @@ filters = config.get('filters', None) if filters: self.add_filters(logger, filters) - + def configure_logger(self, name, config, incremental=False): """Configure a non-root logger from a dictionary.""" logger = logging.getLogger(name) @@ -560,7 +564,7 @@ propagate = config.get('propagate', None) if propagate is not None: logger.propagate = propagate - + def configure_root(self, config, incremental=False): """Configure a root logger from a dictionary.""" root = logging.getLogger() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/logutils/http.py new/logutils-0.3.5/logutils/http.py --- old/logutils-0.3.3/logutils/http.py 2013-01-24 13:50:32.000000000 +0100 +++ new/logutils-0.3.5/logutils/http.py 2017-02-20 18:40:21.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2010-2017 Vinay Sajip. See LICENSE.txt for details. # import logging @@ -37,7 +37,7 @@ Default implementation of mapping the log record into a dict that is sent as the CGI data. Overwrite in your class. Contributed by Franz Glasner. - + :param record: The record to be mapped. """ return record.__dict__ @@ -87,4 +87,3 @@ raise except: self.handleError(record) - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/logutils/queue.py new/logutils-0.3.5/logutils/queue.py --- old/logutils-0.3.3/logutils/queue.py 2013-01-24 13:49:55.000000000 +0100 +++ new/logutils-0.3.5/logutils/queue.py 2017-04-19 21:58:25.000000000 +0200 @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2010-2017 Vinay Sajip. See LICENSE.txt for details. # """ This module contains classes which help you work with queues. A typical @@ -32,7 +32,7 @@ with a multiprocessing Queue to centralise logging to file in one process (in a multi-process application), so as to avoid file write contention between processes. - + :param queue: The queue to send `LogRecords` to. """ @@ -50,7 +50,7 @@ The base implementation uses :meth:`~queue.Queue.put_nowait`. You may want to override this method if you want to use blocking, timeouts or custom queue implementations. - + :param record: The record to enqueue. """ self.queue.put_nowait(record) @@ -67,7 +67,7 @@ You might want to override this method if you want to convert the record to a dict or JSON string, or send a modified copy of the record while leaving the original intact. - + :param record: The record to prepare. """ # The format operation gets traceback text into record.exc_text @@ -87,7 +87,7 @@ Emit a record. Writes the LogRecord to the queue, preparing it for pickling first. - + :param record: The record to emit. """ try: @@ -102,22 +102,22 @@ This class implements an internal threaded listener which watches for LogRecords being added to a queue, removes them and passes them to a list of handlers for processing. - + :param record: The queue to listen to. :param handlers: The handlers to invoke on everything received from the queue. """ _sentinel = None - def __init__(self, queue, *handlers): + def __init__(self, queue, *handlers, **kwargs): """ Initialise an instance with the specified queue and handlers. """ self.queue = queue self.handlers = handlers - self._stop = threading.Event() self._thread = None + self.respect_handler_level = kwargs.get('respect_handler_level', False) def dequeue(self, block): """ @@ -126,7 +126,7 @@ The base implementation uses :meth:`~queue.Queue.get`. You may want to override this method if you want to use timeouts or work with custom queue implementations. - + :param block: Whether to block if the queue is empty. If `False` and the queue is empty, an :class:`~queue.Empty` exception will be thrown. @@ -151,7 +151,7 @@ This method just returns the passed-in record. You may want to override this method if you need to do any custom marshalling or manipulation of the record before passing it to the handlers. - + :param record: The record to prepare. """ return record @@ -167,7 +167,12 @@ """ record = self.prepare(record) for handler in self.handlers: - handler.handle(record) + if not self.respect_handler_level: + process = True + else: + process = record.levelno >= handler.level + if process: + handler.handle(record) def _monitor(self): """ @@ -179,20 +184,9 @@ """ q = self.queue has_task_done = hasattr(q, 'task_done') - while not self._stop.isSet(): - try: - record = self.dequeue(True) - if record is self._sentinel: - break - self.handle(record) - if has_task_done: - q.task_done() - except queue.Empty: - pass - # There might still be records in the queue. while True: try: - record = self.dequeue(False) + record = self.dequeue(True) if record is self._sentinel: break self.handle(record) @@ -218,8 +212,6 @@ Note that if you don't call this before your application exits, there may be some records still left on the queue, which won't be processed. """ - self._stop.set() self.enqueue_sentinel() self._thread.join() self._thread = None - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/logutils/redis.py new/logutils-0.3.5/logutils/redis.py --- old/logutils-0.3.3/logutils/redis.py 2013-01-24 13:49:33.000000000 +0100 +++ new/logutils-0.3.5/logutils/redis.py 2017-02-20 18:40:21.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2011-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2011-2017 Vinay Sajip. See LICENSE.txt for details. # """ This module contains classes which help you work with Redis queues. @@ -15,7 +15,7 @@ """ A QueueHandler implementation which pushes pickled records to a Redis queue using a specified key. - + :param key: The key to use for the queue. Defaults to "python.logging". :param redis: If specified, this instance is used to @@ -31,7 +31,7 @@ assert limit >= 0 self.limit = limit QueueHandler.__init__(self, redis) - + def enqueue(self, record): s = pickle.dumps(vars(record)) self.queue.rpush(self.key, s) @@ -42,7 +42,7 @@ """ A QueueListener implementation which fetches pickled records from a Redis queue using a specified key. - + :param key: The key to use for the queue. Defaults to "python.logging". :param redis: If specified, this instance is used to @@ -63,7 +63,7 @@ if block: s = self.queue.blpop(self.key)[1] else: - s = self.queue.lpop(self.key) + s = self.queue.lpop(self.key) if not s: record = None else: @@ -72,4 +72,3 @@ def enqueue_sentinel(self): self.queue.rpush(self.key, '') - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/logutils/testing.py new/logutils-0.3.5/logutils/testing.py --- old/logutils-0.3.3/logutils/testing.py 2013-01-24 13:49:14.000000000 +0100 +++ new/logutils-0.3.5/logutils/testing.py 2017-02-20 18:40:21.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2010-2017 Vinay Sajip. See LICENSE.txt for details. # import logging from logging.handlers import BufferingHandler @@ -8,7 +8,7 @@ """ This handler collects records in a buffer for later inspection by your unit test code. - + :param matcher: The :class:`~logutils.testing.Matcher` instance to use for matching. """ @@ -54,9 +54,9 @@ Look for a saved dict whose keys/values match the supplied arguments. Return `True` if found, else `False`. - + :param kwargs: A set of keyword arguments whose names are LogRecord - attributes and whose values are what you want to + attributes and whose values are what you want to match in a stored LogRecord. """ result = False @@ -74,7 +74,7 @@ buffer of stored records matches the list one-for-one. Return `True` if exactly matched, else `False`. - + :param kwarglist: A list of keyword-argument dictionaries, each of which will be passed to :meth:`matches` with the corresponding record from the buffer. @@ -102,14 +102,14 @@ :class:`logging.LogRecord` attributes with keyword arguments passed to its :meth:`~logutils.testing.Matcher.matches` method. """ - + _partial_matches = ('msg', 'message') """ A list of :class:`logging.LogRecord` attribute names which will be checked for partial matches. If not in this list, an exact match will be attempted. """ - + def matches(self, d, **kwargs): """ Try to match a single dict with the supplied arguments. @@ -117,11 +117,11 @@ Keys whose values are strings and which are in self._partial_matches will be checked for partial (i.e. substring) matches. You can extend this scheme to (for example) do regular expression matching, etc. - + Return `True` if found, else `False`. :param kwargs: A set of keyword arguments whose names are LogRecord - attributes and whose values are what you want to + attributes and whose values are what you want to match in a stored LogRecord. """ result = True @@ -153,4 +153,3 @@ #if not result: # print('*** matcher failed on %s: %r vs. %r' % (k, dv, v)) return result - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/setup.py new/logutils-0.3.5/setup.py --- old/logutils-0.3.3/setup.py 2013-01-24 13:35:21.000000000 +0100 +++ new/logutils-0.3.5/setup.py 2017-02-20 19:19:58.000000000 +0100 @@ -7,10 +7,10 @@ def description(): - f = open(join(dirname(__file__), 'README.txt')) + f = open(join(dirname(__file__), 'README.rst')) readme = f.read() f.close() - regexp = r'^logutils\s*[\d.]*\s*\n=======+\s*\n(.*)Requirements ' + regexp = r'logutils\s*[\d.]*\s*\n=======+\s*\n(.*)Requirements ' reqts, = re.findall(regexp, readme, re.DOTALL) regexp = r'Availability & Documentation\s*\n-----+\s*\n(.*)' avail, = re.findall(regexp, readme, re.DOTALL) @@ -22,12 +22,14 @@ def run(self): import sys import unittest - + sys.path.append(join(dirname(__file__), 'tests')) import logutil_tests loader = unittest.TestLoader() runner = unittest.TextTestRunner() - runner.run(loader.loadTestsFromModule(logutil_tests)) + test_results = runner.run(loader.loadTestsFromModule(logutil_tests)) + if not test_results.wasSuccessful(): + sys.exit(1) def initialize_options(self): pass @@ -43,7 +45,7 @@ url='http://code.google.com/p/logutils/', description='Logging utilities', long_description = description(), - license='Copyright (C) 2010-2013 by Vinay Sajip. All Rights Reserved. See LICENSE.txt for license.', + license='Copyright (C) 2010-2017 by Vinay Sajip. All Rights Reserved. See LICENSE.txt for license.', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -59,5 +61,5 @@ cmdclass={ 'test': TestCommand, }, - + ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/logutil_tests.py new/logutils-0.3.5/tests/logutil_tests.py --- old/logutils-0.3.3/tests/logutil_tests.py 2013-01-24 13:46:03.000000000 +0100 +++ new/logutils-0.3.5/tests/logutil_tests.py 2017-02-20 18:37:44.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2008-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2008-2017 Vinay Sajip. See LICENSE.txt for details. # import sys from test_testing import LoggingTest diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/mytest.py new/logutils-0.3.5/tests/mytest.py --- old/logutils-0.3.3/tests/mytest.py 2011-11-21 17:10:22.000000000 +0100 +++ new/logutils-0.3.5/tests/mytest.py 2017-02-20 18:40:26.000000000 +0100 @@ -5,5 +5,3 @@ class MyTestHandler(TestHandler): def __init__(self): TestHandler.__init__(self, Matcher()) - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/test_adapter.py new/logutils-0.3.5/tests/test_adapter.py --- old/logutils-0.3.3/tests/test_adapter.py 2013-01-24 13:46:36.000000000 +0100 +++ new/logutils-0.3.5/tests/test_adapter.py 2017-02-20 18:40:26.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2008-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2008-2017 Vinay Sajip. See LICENSE.txt for details. # import logging from logutils.adapter import LoggerAdapter @@ -67,4 +67,3 @@ if __name__ == '__main__': unittest.main() - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/test_colorize.py new/logutils-0.3.5/tests/test_colorize.py --- old/logutils-0.3.3/tests/test_colorize.py 2013-01-24 13:44:37.000000000 +0100 +++ new/logutils-0.3.5/tests/test_colorize.py 2017-02-22 07:33:37.000000000 +0100 @@ -1,10 +1,10 @@ # -# Copyright (C) 2012-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2012-2017 Vinay Sajip. See LICENSE.txt for details. # import logging import logutils.colorize -import os import sys +import tempfile import unittest if sys.version_info[0] < 3: @@ -23,3 +23,17 @@ finally: logger.removeHandler(handler) + def test_colorize_to_file_with_unicode(self): + if sys.version_info >= (3, 0): + raise unittest.SkipTest('tests 2.x specific issue') + logger = logging.getLogger() + with tempfile.TemporaryFile() as logfile_handle: + handler = logutils.colorize.ColorizingStreamHandler(logfile_handle) + logger.addHandler(handler) + try: + logger.warning(u('Some unicode string')) + logfile_handle.seek(0) + self.assertTrue('Some unicode string' in logfile_handle.read()) + finally: + logger.removeHandler(handler) + handler.close() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/test_dictconfig.py new/logutils-0.3.5/tests/test_dictconfig.py --- old/logutils-0.3.3/tests/test_dictconfig.py 2013-01-24 13:44:58.000000000 +0100 +++ new/logutils-0.3.5/tests/test_dictconfig.py 2017-02-20 18:40:26.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright 2009-2013 by Vinay Sajip. See LICENSE.txt for details. +# Copyright 2009-2017 by Vinay Sajip. See LICENSE.txt for details. # import logging from logutils.adapter import LoggerAdapter @@ -44,7 +44,11 @@ self.saved_handlers = logging._handlers.copy() self.saved_handler_list = logging._handlerList[:] self.saved_loggers = logger_dict.copy() - self.saved_level_names = logging._levelNames.copy() + if hasattr(logging, '_levelNames'): + self.saved_level_names = logging._levelNames.copy() + else: + self.saved_level_to_name = logging._levelToName.copy() + self.saved_name_to_level = logging._nameToLevel.copy() finally: logging._releaseLock() @@ -56,8 +60,14 @@ self.root_logger.setLevel(self.original_logging_level) logging._acquireLock() try: - logging._levelNames.clear() - logging._levelNames.update(self.saved_level_names) + if hasattr(logging, '_levelNames'): + logging._levelNames.clear() + logging._levelNames.update(self.saved_level_names) + else: + logging._levelToName.clear() + logging._levelToName.update(self.saved_level_to_name) + logging._nameToLevel.clear() + logging._nameToLevel.update(self.saved_name_to_level) logging._handlers.clear() logging._handlers.update(self.saved_handlers) logging._handlerList[:] = self.saved_handler_list @@ -118,7 +128,7 @@ 'root' : { 'level' : 'WARNING', }, - } + } # config2 has a subtle configuration error that should be reported config2 = { @@ -144,7 +154,7 @@ 'root' : { 'level' : 'WARNING', }, - } + } #As config1 but with a misspelt level on a handler config2a = { @@ -170,7 +180,7 @@ 'root' : { 'level' : 'WARNING', }, - } + } #As config1 but with a misspelt level on a logger @@ -197,7 +207,7 @@ 'root' : { 'level' : 'WRANING', }, - } + } # config3 has a less subtle configuration error config3 = { @@ -223,7 +233,7 @@ 'root' : { 'level' : 'WARNING', }, - } + } # config4 specifies a custom formatter class to be loaded config4 = { @@ -244,7 +254,7 @@ 'level' : 'NOTSET', 'handlers' : ['hand1'], }, - } + } # As config4 but using an actual callable rather than a string config4a = { @@ -276,7 +286,7 @@ 'level' : 'NOTSET', 'handlers' : ['hand1'], }, - } + } # config5 specifies a custom handler class to be loaded config5 = { @@ -301,7 +311,7 @@ 'root' : { 'level' : 'WARNING', }, - } + } # config6 specifies a custom handler class to be loaded # but has bad arguments @@ -329,7 +339,7 @@ 'root' : { 'level' : 'WARNING', }, - } + } #config 7 does not define compiler.parser but defines compiler.lexer #so compiler.parser should be disabled after applying it @@ -355,7 +365,7 @@ 'root' : { 'level' : 'WARNING', }, - } + } config8 = { 'version': 1, @@ -382,7 +392,7 @@ 'root' : { 'level' : 'WARNING', }, - } + } config9 = { 'version': 1, @@ -406,7 +416,7 @@ 'root' : { 'level' : 'NOTSET', }, - } + } config9a = { 'version': 1, @@ -421,7 +431,7 @@ 'level' : 'INFO', }, }, - } + } config9b = { 'version': 1, @@ -436,7 +446,7 @@ 'level' : 'INFO', }, }, - } + } #As config1 but with a filter added config10 = { @@ -468,7 +478,7 @@ 'level' : 'WARNING', 'handlers' : ['hand1'], }, - } + } # As config10, but declaring a handler in a module using # absolute imports @@ -501,7 +511,7 @@ 'level' : 'WARNING', 'handlers' : ['hand1'], }, - } + } def apply_config(self, conf): dictConfig(conf) @@ -679,10 +689,9 @@ dict(levelname='WARNING', message='1'), dict(levelname='ERROR', message='4'), ])) - + def test_config_11_ok(self): self.apply_config(self.config11) h = logging.getLogger().handlers[0] self.assertEqual(h.__module__, 'mytest') self.assertEqual(h.__class__.__name__, 'MyTestHandler') - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/test_formatter.py new/logutils-0.3.5/tests/test_formatter.py --- old/logutils-0.3.3/tests/test_formatter.py 2013-01-24 13:46:51.000000000 +0100 +++ new/logutils-0.3.5/tests/test_formatter.py 2017-02-20 18:40:26.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2009-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2009-2017 Vinay Sajip. See LICENSE.txt for details. # import logging import logutils @@ -71,5 +71,3 @@ self.assertTrue(f.usesTime()) f = logutils.Formatter('asctime', style='$') self.assertFalse(f.usesTime()) - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/test_messages.py new/logutils-0.3.5/tests/test_messages.py --- old/logutils-0.3.3/tests/test_messages.py 2010-10-28 10:22:35.000000000 +0200 +++ new/logutils-0.3.5/tests/test_messages.py 2017-02-20 18:40:26.000000000 +0100 @@ -13,7 +13,7 @@ self.assertEqual(str(m), 'Message with 2 placeholders') m = __('Message without {0:x} {1}', 16, 'placeholders') self.assertEqual(str(m), 'Message without 10 placeholders') - + class Dummy: pass @@ -31,5 +31,3 @@ ignored = object() self.assertRaises(TypeError, __, 'Message with $num ${what}', ignored, num=2, what='placeholders') - - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/test_queue.py new/logutils-0.3.5/tests/test_queue.py --- old/logutils-0.3.3/tests/test_queue.py 2013-01-24 13:47:30.000000000 +0100 +++ new/logutils-0.3.5/tests/test_queue.py 2017-02-20 18:40:26.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2010-2017 Vinay Sajip. See LICENSE.txt for details. # import logging from logutils.testing import TestHandler, Matcher @@ -67,4 +67,3 @@ if __name__ == '__main__': unittest.main() - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/test_redis.py new/logutils-0.3.5/tests/test_redis.py --- old/logutils-0.3.3/tests/test_redis.py 2013-01-24 13:47:37.000000000 +0100 +++ new/logutils-0.3.5/tests/test_redis.py 2017-02-20 18:40:26.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2011-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2011-2017 Vinay Sajip. See LICENSE.txt for details. # import logging from logutils.testing import TestHandler, Matcher @@ -49,7 +49,7 @@ if time.time() >= maxtime: raise Exception('unable to connect to Redis server') sock.close() - + def test_simple(self): "Simple test of queue handling and listening." # Just as a demo, let's log some messages. @@ -96,4 +96,3 @@ if __name__ == '__main__': unittest.main() - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/logutils-0.3.3/tests/test_testing.py new/logutils-0.3.5/tests/test_testing.py --- old/logutils-0.3.3/tests/test_testing.py 2013-01-24 13:47:43.000000000 +0100 +++ new/logutils-0.3.5/tests/test_testing.py 2017-02-20 18:40:26.000000000 +0100 @@ -1,5 +1,5 @@ # -# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# Copyright (C) 2010-2017 Vinay Sajip. See LICENSE.txt for details. # import logging from logutils.testing import TestHandler, Matcher @@ -57,4 +57,3 @@ if __name__ == '__main__': unittest.main() -
