<s> import sys <EOL> import traceback <EOL> display_log = False <EOL> def init_log ( _display_log ) : <EOL> global display_log <EOL> display_log = _display_log <EOL> def log ( msg ) : <EOL> global display_log <EOL> if display_log : <EOL> sys . stderr . write ( "<STR_LIT>" . format ( msg ) ) <EOL> def warning ( msg ) : <EOL> sys . stderr . write ( "<STR_LIT>" . format ( msg ) ) <EOL> def error ( msg , e = None ) : <EOL> sys . stderr . write ( "<STR_LIT>" . format ( msg ) ) <EOL> if e is not None : <EOL> sys . stderr . write ( traceback . format_exc ( ) ) </s>
