Remove the usage of set,list,dict and use the collections
iterable which performs the same, but can handle iterator types beyond those three.
This commit is contained in:
parent
c2f8f31d43
commit
50c5dc6931
@ -24,6 +24,7 @@ import logging
|
|||||||
import logging.handlers
|
import logging.handlers
|
||||||
import logging.config
|
import logging.config
|
||||||
|
|
||||||
|
import collections
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -63,9 +64,11 @@ def setupLogging(cfg=None):
|
|||||||
# If there is a 'logcfg' entry in the config,
|
# If there is a 'logcfg' entry in the config,
|
||||||
# respect it, it is the old keyname
|
# respect it, it is the old keyname
|
||||||
log_cfgs.append(str(log_cfg))
|
log_cfgs.append(str(log_cfg))
|
||||||
elif "log_cfgs" in cfg and isinstance(cfg['log_cfgs'], (set, list)):
|
elif "log_cfgs" in cfg:
|
||||||
for a_cfg in cfg['log_cfgs']:
|
for a_cfg in cfg['log_cfgs']:
|
||||||
if isinstance(a_cfg, (list, set, dict)):
|
if isinstance(a_cfg, (basestring, str)):
|
||||||
|
log_cfgs.append(a_cfg)
|
||||||
|
elif isinstance(a_cfg, (collections.Iterable)):
|
||||||
cfg_str = [str(c) for c in a_cfg]
|
cfg_str = [str(c) for c in a_cfg]
|
||||||
log_cfgs.append('\n'.join(cfg_str))
|
log_cfgs.append('\n'.join(cfg_str))
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user