summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2011-01-24 10:58:28 +0000
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2011-01-24 10:58:28 +0000
commit25f7fa03a204cce1e3f982ae2833af0d5af215ab (patch)
treefa4616267024efae62e4533ba9b55c20d6867317
parent00b0a30ce158a71871d14828921bd66e529014f0 (diff)
downloadlogutils-git-25f7fa03a204cce1e3f982ae2833af0d5af215ab.tar.gz
Changes for 0.3.
-rw-r--r--.hgtags1
-rw-r--r--NEWS.txt8
-rw-r--r--doc/index.rst1
-rw-r--r--logutils/__init__.py14
4 files changed, 20 insertions, 4 deletions
diff --git a/.hgtags b/.hgtags
index c994159..8388fc4 100644
--- a/.hgtags
+++ b/.hgtags
@@ -1,2 +1,3 @@
fb88d715212ede9b27c6cd98d19c9d90a81a9b92 0.1
bbc87ba2598d6253524c4326e9f24e6685ef9642 0.2
+6f2d5485f32c9c41409a963abfb5ab3b45d75df4 0.3
diff --git a/NEWS.txt b/NEWS.txt
index 5f5f32a..026a0a3 100644
--- a/NEWS.txt
+++ b/NEWS.txt
@@ -1,6 +1,14 @@
What's New in logutils
======================
+Version 0.3
+-----------
+
+- Added caches for BraceMessage/DollarMessage.
+
+- Added ColorizingStreamHandler.
+
+
Version 0.2
-----------
diff --git a/doc/index.rst b/doc/index.rst
index 2d971ee..56aab6a 100644
--- a/doc/index.rst
+++ b/doc/index.rst
@@ -19,6 +19,7 @@ tasks you may want to perform:
dictconfig
adapter
http
+ colorize
Indices and tables
==================
diff --git a/logutils/__init__.py b/logutils/__init__.py
index 6ec0e0b..f917643 100644
--- a/logutils/__init__.py
+++ b/logutils/__init__.py
@@ -10,7 +10,7 @@ of Python, and so are packaged here.
import logging
from string import Template
-__version__ = '0.2'
+__version__ = '0.3'
class NullHandler(logging.Handler):
"""
@@ -156,18 +156,24 @@ class BraceMessage(object):
self.fmt = fmt
self.args = args
self.kwargs = kwargs
+ self.str = None
def __str__(self):
- return self.fmt.format(*self.args, **self.kwargs)
+ if self.str is None:
+ self.str = self.fmt.format(*self.args, **self.kwargs)
+ return self.str
class DollarMessage(object):
def __init__(self, fmt, **kwargs):
self.fmt = fmt
self.kwargs = kwargs
+ self.str = None
def __str__(self):
- from string import Template
- return Template(self.fmt).substitute(**self.kwargs)
+ if self.str is None:
+ self.str = Template(self.fmt).substitute(**self.kwargs)
+ return self.str
+
def hasHandlers(logger):
"""