<s> import os <EOL> import logging <EOL> class AttrDict ( dict ) : <EOL> """<STR_LIT>""" <EOL> def __getattr__ ( self , name ) : <EOL> if name in self : <EOL> return self [ name ] <EOL> raise AttributeError ( '<STR_LIT>' % name ) <EOL> def __setattr__ ( self , name , val ) : <EOL> self [ name ] = val <EOL> def get_logger ( name , level = None ) : <EOL> """<STR_LIT>""" <EOL> logger = logging . getLogger ( name ) <EOL> if not logger . handlers : <EOL> stderr = logging . StreamHandler ( ) <EOL> stderr . setFormatter ( logging . Formatter ( <EOL> '<STR_LIT>' ) ) <EOL> logger . addHandler ( stderr ) <EOL> level = level if level else os . environ . get ( '<STR_LIT>' , '<STR_LIT>' ) <EOL> logger . setLevel ( getattr ( logging , level ) ) <EOL> return logger </s>
