Esempio n. 1
0
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!')
Esempio n. 2
0
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)
Esempio n. 3
0
 def app(event, api):
     Logger.info('Info message!')
Esempio n. 4
0
 def app(event, api):
     Logger.warning('Hello, World!')
Esempio n. 5
0
 def app(event, api, cache):
     Logger.warning('Hello, World!')
     Logger.warning('This should not be printed as logging is disabled.')
Esempio n. 6
0
 def app(event, api, cache):
     Logger.debug('Debug message.')
     Logger.info('Info message.')
Esempio n. 7
0
def task_app(event: TaskEvent, api: Api):
    Logger.info('Info message!')  # <.>