Vibora Docs
Search…
Logging
Vibora has a simple logging mechanism to avoid locking you into our library of choice.
You must provide a function that receives two parameters: a msg and a logging level (that matches logging standard library for usability sake).
That's all.
It's up to you to choose what to do with logging messages.
1
import logging
2
from vibora import Vibora, Response
3
4
app = Vibora()
5
6
@app.route('/')
7
def home():
8
return Response(b'Hello World')
9
10
if __name__ == '__main__':
11
def log_handler(msg, level):
12
# Redirecting the msg and level to logging library.
13
getattr(logging, level)(msg)
14
print(f'Msg: {msg} / Level: {level}')
15
16
app.run(logging=log_handler)
Copied!
Last modified 3yr ago
Copy link