diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-01-24 12:52:32 +0000 |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2013-01-24 12:52:32 +0000 |
commit | 095f14efbaaf838b7772bffd36a466abb9668efe (patch) | |
tree | a5141b7709c586ac58952d0d87dc1899a79fe5fb | |
parent | 6844371fef78a28743e72ff7ce92bb786c64073e (diff) | |
download | logutils-095f14efbaaf838b7772bffd36a466abb9668efe.tar.gz |
Changes for 0.3.3.0.3.3
-rw-r--r-- | LICENSE.txt | 2 | ||||
-rw-r--r-- | NEWS.txt | 5 | ||||
-rw-r--r-- | README.txt | 4 | ||||
-rw-r--r-- | doc/conf.py | 4 | ||||
-rw-r--r-- | logutils/__init__.py | 5 | ||||
-rw-r--r-- | logutils/adapter.py | 16 | ||||
-rw-r--r-- | logutils/colorize.py | 10 | ||||
-rw-r--r-- | logutils/dictconfig.py | 17 | ||||
-rw-r--r-- | logutils/http.py | 3 | ||||
-rw-r--r-- | logutils/queue.py | 15 | ||||
-rw-r--r-- | logutils/redis.py | 3 | ||||
-rw-r--r-- | logutils/testing.py | 15 | ||||
-rw-r--r-- | setup.py | 3 | ||||
-rw-r--r-- | tests/logutil_tests.py | 4 | ||||
-rw-r--r-- | tests/test_adapter.py | 3 | ||||
-rw-r--r-- | tests/test_colorize.py | 25 | ||||
-rw-r--r-- | tests/test_dictconfig.py | 17 | ||||
-rw-r--r-- | tests/test_formatter.py | 3 | ||||
-rw-r--r-- | tests/test_queue.py | 3 | ||||
-rw-r--r-- | tests/test_redis.py | 3 | ||||
-rw-r--r-- | tests/test_testing.py | 3 |
21 files changed, 82 insertions, 81 deletions
diff --git a/LICENSE.txt b/LICENSE.txt index 621d87b..292324b 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,4 +1,4 @@ -Copyright (c) 2008-2011 by Vinay Sajip. +Copyright (c) 2008-2013 by Vinay Sajip. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -5,6 +5,11 @@ What's New in logutils ====================== +Version 0.3.3 +------------- + +- Added encoding support to ColorizingStreamHandler. + Version 0.3.2 ------------- @@ -1,5 +1,5 @@ -logutils 0.1 -============ +logutils 0.3.3 +============== The logutils package provides a set of handlers for the Python standard library's logging package. diff --git a/doc/conf.py b/doc/conf.py index 2eb049a..cd092a9 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -42,7 +42,7 @@ master_doc = 'index' # General information about the project. project = u'Logutils' -copyright = u'2010-2011, Vinay Sajip' +copyright = u'2010-2013, 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 @@ copyright = u'2010-2011, Vinay Sajip' # The short X.Y version. version = '0.3' # The full version, including alpha/beta/rc tags. -release = '0.3.2' +release = '0.3.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/logutils/__init__.py b/logutils/__init__.py index f9a677c..44e261f 100644 --- a/logutils/__init__.py +++ b/logutils/__init__.py @@ -1,3 +1,6 @@ +# +# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# """ The logutils package provides a set of handlers for the Python standard library's logging package. @@ -10,7 +13,7 @@ of Python, and so are packaged here. import logging from string import Template -__version__ = '0.3.2' +__version__ = '0.3.3' class NullHandler(logging.Handler): """ diff --git a/logutils/adapter.py b/logutils/adapter.py index a9f5275..399e1ee 100644 --- a/logutils/adapter.py +++ b/logutils/adapter.py @@ -1,20 +1,6 @@ -# Copyright (C) 2010 Vinay Sajip. All Rights Reserved. # -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, -# provided that the above copyright notice appear in all copies and that -# both that copyright notice and this permission notice appear in -# supporting documentation, and that the name of Vinay Sajip -# not be used in advertising or publicity pertaining to distribution -# of the software without specific, written prior permission. -# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL -# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. # - import logging import logutils diff --git a/logutils/colorize.py b/logutils/colorize.py index 3dfaad0..2c39639 100644 --- a/logutils/colorize.py +++ b/logutils/colorize.py @@ -1,10 +1,15 @@ # -# Copyright (C) 2010-2011 Vinay Sajip. All rights reserved. +# Copyright (C) 2010-2013 Vinay Sajip. All rights reserved. # import ctypes import logging import os +try: + unicode +except NameError: + unicode = None + class ColorizingStreamHandler(logging.StreamHandler): """ A stream handler which supports colorizing of console streams @@ -58,6 +63,9 @@ class ColorizingStreamHandler(logging.StreamHandler): try: message = self.format(record) stream = self.stream + if unicode and isinstance(message, unicode): + enc = getattr(stream, 'encoding', 'utf-8') + message = message.encode(enc, 'replace') if not self.is_tty: stream.write(message) else: diff --git a/logutils/dictconfig.py b/logutils/dictconfig.py index a4f07cb..4a2281f 100644 --- a/logutils/dictconfig.py +++ b/logutils/dictconfig.py @@ -1,19 +1,6 @@ -# Copyright 2009-2010 by Vinay Sajip. All Rights Reserved. # -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, -# provided that the above copyright notice appear in all copies and that -# both that copyright notice and this permission notice appear in -# supporting documentation, and that the name of Vinay Sajip -# not be used in advertising or publicity pertaining to distribution -# of the software without specific, written prior permission. -# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL -# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - +# Copyright (C) 2009-2013 Vinay Sajip. See LICENSE.txt for details. +# import logging.handlers import re import sys diff --git a/logutils/http.py b/logutils/http.py index c3c6c57..5d145c3 100644 --- a/logutils/http.py +++ b/logutils/http.py @@ -1,3 +1,6 @@ +# +# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# import logging class HTTPHandler(logging.Handler): diff --git a/logutils/queue.py b/logutils/queue.py index 39be637..cced8c5 100644 --- a/logutils/queue.py +++ b/logutils/queue.py @@ -1,18 +1,5 @@ -# Copyright (C) 2010 Vinay Sajip. All Rights Reserved. # -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, -# provided that the above copyright notice appear in all copies and that -# both that copyright notice and this permission notice appear in -# supporting documentation, and that the name of Vinay Sajip -# not be used in advertising or publicity pertaining to distribution -# of the software without specific, written prior permission. -# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL -# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. # """ This module contains classes which help you work with queues. A typical diff --git a/logutils/redis.py b/logutils/redis.py index 2d7c6bf..0fea2d1 100644 --- a/logutils/redis.py +++ b/logutils/redis.py @@ -1,3 +1,6 @@ +# +# Copyright (C) 2011-2013 Vinay Sajip. See LICENSE.txt for details. +# """ This module contains classes which help you work with Redis queues. """ diff --git a/logutils/testing.py b/logutils/testing.py index 2a623ce..dfc8d21 100644 --- a/logutils/testing.py +++ b/logutils/testing.py @@ -1,18 +1,5 @@ -# Copyright (C) 2010 Vinay Sajip. All Rights Reserved. # -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, -# provided that the above copyright notice appear in all copies and that -# both that copyright notice and this permission notice appear in -# supporting documentation, and that the name of Vinay Sajip -# not be used in advertising or publicity pertaining to distribution -# of the software without specific, written prior permission. -# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL -# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. # import logging from logging.handlers import BufferingHandler @@ -43,7 +43,7 @@ distutils.core.setup( url='http://code.google.com/p/logutils/', description='Logging utilities', long_description = description(), - license='Copyright (C) 2010-2011 by Vinay Sajip. All Rights Reserved. See LICENSE.txt for license.', + license='Copyright (C) 2010-2013 by Vinay Sajip. All Rights Reserved. See LICENSE.txt for license.', classifiers=[ 'Development Status :: 5 - Production/Stable', 'Environment :: Console', @@ -51,6 +51,7 @@ distutils.core.setup( 'License :: OSI Approved :: BSD License', 'Operating System :: OS Independent', 'Programming Language :: Python', + "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", 'Topic :: Software Development', ], diff --git a/tests/logutil_tests.py b/tests/logutil_tests.py index 330594c..5a9996d 100644 --- a/tests/logutil_tests.py +++ b/tests/logutil_tests.py @@ -1,9 +1,13 @@ +# +# Copyright (C) 2008-2013 Vinay Sajip. See LICENSE.txt for details. +# import sys from test_testing import LoggingTest from test_dictconfig import ConfigDictTest from test_queue import QueueTest from test_formatter import FormatterTest from test_messages import MessageTest +from test_colorize import ColorizeTest try: from test_redis import RedisQueueTest except ImportError: diff --git a/tests/test_adapter.py b/tests/test_adapter.py index bb008a0..0b7e1fa 100644 --- a/tests/test_adapter.py +++ b/tests/test_adapter.py @@ -1,3 +1,6 @@ +# +# Copyright (C) 2008-2013 Vinay Sajip. See LICENSE.txt for details. +# import logging from logutils.adapter import LoggerAdapter from logutils.testing import TestHandler, Matcher diff --git a/tests/test_colorize.py b/tests/test_colorize.py new file mode 100644 index 0000000..5ec0bb4 --- /dev/null +++ b/tests/test_colorize.py @@ -0,0 +1,25 @@ +# +# Copyright (C) 2012-2013 Vinay Sajip. See LICENSE.txt for details. +# +import logging +import logutils.colorize +import os +import sys +import unittest + +if sys.version_info[0] < 3: + u = lambda o: unicode(o, 'unicode_escape') +else: + u = lambda o: o + +class ColorizeTest(unittest.TestCase): + + def test_colorize(self): + logger = logging.getLogger() + handler = logutils.colorize.ColorizingStreamHandler() + logger.addHandler(handler) + try: + logger.warning(u('Some unicode string with some \u015b\u0107\u017a\xf3\u0142 chars')) + finally: + logger.removeHandler(handler) + diff --git a/tests/test_dictconfig.py b/tests/test_dictconfig.py index 42647a2..bf2ce11 100644 --- a/tests/test_dictconfig.py +++ b/tests/test_dictconfig.py @@ -1,19 +1,6 @@ -# Copyright 2009-2010 by Vinay Sajip. All Rights Reserved. # -# Permission to use, copy, modify, and distribute this software and its -# documentation for any purpose and without fee is hereby granted, -# provided that the above copyright notice appear in all copies and that -# both that copyright notice and this permission notice appear in -# supporting documentation, and that the name of Vinay Sajip -# not be used in advertising or publicity pertaining to distribution -# of the software without specific, written prior permission. -# VINAY SAJIP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -# ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL -# VINAY SAJIP BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR -# ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER -# IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT -# OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - +# Copyright 2009-2013 by Vinay Sajip. See LICENSE.txt for details. +# import logging from logutils.adapter import LoggerAdapter from logutils.dictconfig import dictConfig, named_handlers_supported diff --git a/tests/test_formatter.py b/tests/test_formatter.py index 2c05428..0e73ecf 100644 --- a/tests/test_formatter.py +++ b/tests/test_formatter.py @@ -1,3 +1,6 @@ +# +# Copyright (C) 2009-2013 Vinay Sajip. See LICENSE.txt for details. +# import logging import logutils import os diff --git a/tests/test_queue.py b/tests/test_queue.py index 1f86837..5969d0e 100644 --- a/tests/test_queue.py +++ b/tests/test_queue.py @@ -1,3 +1,6 @@ +# +# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# import logging from logutils.testing import TestHandler, Matcher from logutils.queue import QueueHandler, QueueListener, queue diff --git a/tests/test_redis.py b/tests/test_redis.py index cc319cb..dfa7a8f 100644 --- a/tests/test_redis.py +++ b/tests/test_redis.py @@ -1,3 +1,6 @@ +# +# Copyright (C) 2011-2013 Vinay Sajip. See LICENSE.txt for details. +# import logging from logutils.testing import TestHandler, Matcher from logutils.redis import RedisQueueHandler, RedisQueueListener diff --git a/tests/test_testing.py b/tests/test_testing.py index 3fb3e9f..f01fc09 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -1,3 +1,6 @@ +# +# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details. +# import logging from logutils.testing import TestHandler, Matcher import unittest |