def task_app(event: TaskEvent, api: Api): # <.> Logger.debug('Debug message!') Logger.info('Info message!') Logger.warning('Warning message!') Logger.error('Error message!') try: 0 / 0 except ZeroDivisionError: Logger.exception('Exception message!')
def test_tutorial001(app_runner, mocker: MockerFixture, capsys): event = TaskEvent(asset_id=0, company_id=0) Logger.setLevel('DEBUG') # Add handler, as Logger doesnt have one by default handler = logging.StreamHandler() handler.setLevel('DEBUG') mocker.patch.object(Logger, 'handlers', [handler]) app_runner(tutorial001.task_app, event) expected = ('Debug message!\nInfo message!\nWarning message!\n' 'Error message!\nException message!\n') captured = capsys.readouterr().err assert captured.startswith(expected)
def app(event, api): Logger.info('Info message!')
def app(event, api): Logger.warning('Hello, World!')
def app(event, api, cache): Logger.warning('Hello, World!') Logger.warning('This should not be printed as logging is disabled.')
def app(event, api, cache): Logger.debug('Debug message.') Logger.info('Info message.')
def task_app(event: TaskEvent, api: Api): Logger.info('Info message!') # <.>