diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2004-09-22 12:39:26 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2004-09-22 12:39:26 (GMT) |
commit | b9591174df4a330f75b1a5dc4893af063b8a7b7f (patch) | |
tree | eaa53a8328992464226a92de64f0bacf5a4207fa /Lib/logging/__init__.py | |
parent | a2fc7ec80aea43768c11c50922a665a08b3885c0 (diff) | |
download | cpython-b9591174df4a330f75b1a5dc4893af063b8a7b7f.zip cpython-b9591174df4a330f75b1a5dc4893af063b8a7b7f.tar.gz cpython-b9591174df4a330f75b1a5dc4893af063b8a7b7f.tar.bz2 |
Added getLoggerClass()
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r-- | Lib/logging/__init__.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index 5632acd..08e6e47 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -36,8 +36,8 @@ except ImportError: __author__ = "Vinay Sajip <vinay_sajip@red-dove.com>" __status__ = "beta" -__version__ = "0.4.9.3" -__date__ = "08 July 2004" +__version__ = "0.4.9.4" +__date__ = "22 September 2004" #--------------------------------------------------------------------------- # Miscellaneous module data @@ -689,13 +689,14 @@ class StreamHandler(Handler): """ try: msg = self.format(record) + fs = "%s\n" if not hasattr(types, "UnicodeType"): #if no unicode support... - self.stream.write("%s\n" % msg) + self.stream.write(fs % msg) else: try: - self.stream.write("%s\n" % msg) + self.stream.write(fs % msg) except UnicodeError: - self.stream.write("%s\n" % msg.encode("UTF-8")) + self.stream.write(fs % msg.encode("UTF-8")) self.flush() except: self.handleError(record) @@ -763,6 +764,13 @@ def setLoggerClass(klass): global _loggerClass _loggerClass = klass +def getLoggerClass(): + """ + Return the class to be used when instantiating a logger. + """ + + return _loggerClass + class Manager: """ There is [under normal circumstances] just one Manager instance, which @@ -780,7 +788,8 @@ class Manager: def getLogger(self, name): """ Get a logger with the specified name (channel name), creating it - if it doesn't yet exist. + if it doesn't yet exist. This name is a dot-separated hierarchical + name, such as "a", "a.b", "a.b.c" or similar. If a PlaceHolder existed for the specified name [i.e. the logger didn't exist but a child of it did], replace it with the created @@ -879,12 +888,6 @@ class Logger(Filterer): """ self.level = level -# def getRoot(self): -# """ -# Get the root of the logger hierarchy. -# """ -# return Logger.root - def debug(self, msg, *args, **kwargs): """ Log 'msg % args' with severity 'DEBUG'. |