<s> from __future__ import ( absolute_import , division , print_function , <EOL> unicode_literals ) <EOL> import logging <EOL> from rq . utils import ColorizingStreamHandler <EOL> def setup_loghandlers ( level ) : <EOL> logger = logging . getLogger ( '<STR_LIT>' ) <EOL> if not _has_effective_handler ( logger ) : <EOL> logger . setLevel ( level ) <EOL> if logger . getEffectiveLevel ( ) == level : <EOL> level_int = getattr ( logging , level ) <EOL> logger . setLevel ( level_int ) <EOL> formatter = logging . Formatter ( fmt = '<STR_LIT>' , <EOL> datefmt = '<STR_LIT>' ) <EOL> handler = ColorizingStreamHandler ( ) <EOL> handler . setFormatter ( formatter ) <EOL> logger . addHandler ( handler ) <EOL> def _has_effective_handler ( logger ) : <EOL> """<STR_LIT>""" <EOL> while True : <EOL> if logger . handlers : <EOL> return True <EOL> if not logger . parent : <EOL> return False <EOL> logger = logger . parent </s>
