Don't acquire lock if there is no formatter

this cause locking when a log handler don't have a formatter (because it don't need one)
This commit is contained in:
Bruno Clermont 2015-07-24 15:07:50 +08:00 committed by rallytime
parent 1fae76d53c
commit 0aa1416b6b

View file

@ -121,14 +121,14 @@ class SaltLoggingClass(with_metaclass(LoggingMixInMeta, LOGGING_LOGGER_CLASS, Ne
LOGGING_TEMP_HANDLER):
continue
if not handler.lock:
handler.createLock()
handler.acquire()
formatter = handler.formatter
if not formatter:
continue
if not handler.lock:
handler.createLock()
handler.acquire()
fmt = formatter._fmt.replace('%', '%%')
match = MODNAME_PATTERN.search(fmt)