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