<s> from __future__ import unicode_literals <EOL> from __future__ import print_function <EOL> import os <EOL> import logging <EOL> class SawsLogger ( object ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , name , log_file , log_level ) : <EOL> """<STR_LIT>""" <EOL> self . logger = logging . getLogger ( name ) <EOL> level_map = { <EOL> '<STR_LIT>' : logging . CRITICAL , <EOL> '<STR_LIT>' : logging . ERROR , <EOL> '<STR_LIT>' : logging . WARNING , <EOL> '<STR_LIT>' : logging . INFO , <EOL> '<STR_LIT>' : logging . DEBUG <EOL> } <EOL> handler = logging . FileHandler ( os . path . expanduser ( log_file ) ) <EOL> formatter = logging . Formatter ( <EOL> '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> handler . setFormatter ( formatter ) <EOL> root_logger = logging . getLogger ( '<STR_LIT>' ) <EOL> root_logger . addHandler ( handler ) <EOL> root_logger . setLevel ( level_map [ log_level . upper ( ) ] ) <EOL> root_logger . debug ( '<STR_LIT>' ) <EOL> root_logger . debug ( '<STR_LIT>' , log_file ) </s>
