Skip to main content Link Menu Expand (external link) Document Search Copy Copied

If you want to print your log messages, you can make use of server['logger'] within handlers or middlewares. It is a Python’s Logger object.

You are responsible for sanitizing input to the logger.

from tremolo import Tremolo

app = Tremolo()

@app.route('/hello')
async def hello_world(**server):
    logger = server['logger']

    logger.info('Current page: /hello')
    return 'Hello world!', 'latin-1'

if __name__ == '__main__':
    app.run('0.0.0.0', 8000, debug=True)