Commit 05a710bc authored by U. Artie Eoff's avatar U. Artie Eoff Committed by Chad Versace
Browse files

Add synchronization to Logger functions.

Add synchronization decorator to Logger functions for multithreaded
logging support.
parent 6388cf7b
...@@ -21,13 +21,16 @@ ...@@ -21,13 +21,16 @@
# IN THE SOFTWARE. # IN THE SOFTWARE.
# #
from threads import synchronized_self
from patterns import Singleton from patterns import Singleton
import logging import logging
class Logger(Singleton): class Logger(Singleton):
@synchronized_self
def __logMessage(self, logfunc, message, **kwargs): def __logMessage(self, logfunc, message, **kwargs):
[logfunc(line, **kwargs) for line in message.split('\n')] [logfunc(line, **kwargs) for line in message.split('\n')]
@synchronized_self
def getLogger(self, channel = None): def getLogger(self, channel = None):
if 0 == len(logging.root.handlers): if 0 == len(logging.root.handlers):
logging.basicConfig( logging.basicConfig(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment