<s> """<STR_LIT>""" <EOL> import logging <EOL> from cement . core import exc , backend , log <EOL> from cement . utils import test <EOL> from cement . utils . misc import init_defaults <EOL> class BogusHandler1 ( log . CementLogHandler ) : <EOL> class Meta : <EOL> interface = log . ILog <EOL> label = '<STR_LIT>' <EOL> class LogTestCase ( test . CementCoreTestCase ) : <EOL> def setUp ( self ) : <EOL> self . app = self . make_app ( ) <EOL> @ test . raises ( exc . InterfaceError ) <EOL> def test_unproviding_handler ( self ) : <EOL> try : <EOL> self . app . handler . register ( BogusHandler1 ) <EOL> except exc . InterfaceError : <EOL> raise <EOL> def test_logging ( self ) : <EOL> defaults = init_defaults ( ) <EOL> defaults [ '<STR_LIT>' ] = dict ( <EOL> file = '<STR_LIT>' , <EOL> to_console = True <EOL> ) <EOL> app = self . make_app ( config_defaults = defaults ) <EOL> app . setup ( ) <EOL> app . log . info ( '<STR_LIT>' ) <EOL> app . log . warn ( '<STR_LIT>' ) <EOL> app . log . error ( '<STR_LIT>' ) <EOL> app . log . fatal ( '<STR_LIT>' ) <EOL> app . log . debug ( '<STR_LIT>' ) <EOL> def test_bogus_log_level ( self ) : <EOL> app = self . make_app ( '<STR_LIT:test>' ) <EOL> app . setup ( ) <EOL> app . config . set ( '<STR_LIT>' , '<STR_LIT:file>' , '<STR_LIT>' ) <EOL> app . config . set ( '<STR_LIT>' , '<STR_LIT>' , True ) <EOL> app . log . _setup ( app ) <EOL> app . log . set_level ( '<STR_LIT>' ) <EOL> def test_get_level ( self ) : <EOL> self . app . setup ( ) <EOL> self . eq ( '<STR_LIT>' , self . app . log . get_level ( ) ) <EOL> def test_console_log ( self ) : <EOL> app = self . make_app ( '<STR_LIT:test>' , debug = True ) <EOL> app . setup ( ) <EOL> app . config . set ( '<STR_LIT>' , '<STR_LIT:file>' , '<STR_LIT>' ) <EOL> app . config . set ( '<STR_LIT>' , '<STR_LIT>' , True ) <EOL> app . log . _setup ( app ) <EOL> app . log . info ( '<STR_LIT>' ) </s>
