Jiushu logger for Flask routes.
Project description
jiushu-logger-flask【九书 Flask 路由专用】
简介
JF 专用格式化 logger 的 Flask 路由特供版,专门输出请求日志。
使用方法
import orjson
from flask import Flask, g
from jiushu_logger_flask import RouteLogging
app = Flask(__name__)
# Logging for routes.
# You can set which route should be skipped,
# or which pattern the route matches should be skipped.
RouteLogging(app,
skip_routes=['/api/health'],
skip_regexes=[r'''^.*skip.*$'''])
@app.get('/api/test')
def _test():
# You can get trace id of *this* request.
# If apache-skywalking is used, this trace_id will be the ID tracing by skywalking.
print(g.trace_id)
return b'Hello, world!', 200
@app.get('/api/health')
def _health():
return orjson.dumps({'status': 'UP'}), 200, {'Content-Type': 'application/json'}
app.run('0.0.0.0', 8080)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jiushu_logger_flask-1.0.0.tar.gz
(15.3 kB
view details)
Built Distribution
File details
Details for the file jiushu_logger_flask-1.0.0.tar.gz
.
File metadata
- Download URL: jiushu_logger_flask-1.0.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0626515c56a03fa96da32e38e9018105465ef9a6d369b247cb3406e6540ae534 |
|
MD5 | 1af02693f599ec639594579f09ad8b2e |
|
BLAKE2b-256 | eb41966908bbaf2884a9c3afe4af3984827a727aba686af0842954f8ef0da252 |
File details
Details for the file jiushu_logger_flask-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: jiushu_logger_flask-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0664e7eb21dda28935e9b9df7b2eab1c3c1ffa3e71fe28ecd2fd74ab6f631c3a |
|
MD5 | b815b56a0aee8ebe57a280413d4f49f6 |
|
BLAKE2b-256 | 8a3af88923991c70bb49a9a45950c909db2d1d61c6ce13b57320d381ec0422be |