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.2.tar.gz
(14.9 kB
view details)
Built Distribution
File details
Details for the file jiushu_logger_flask-1.0.2.tar.gz
.
File metadata
- Download URL: jiushu_logger_flask-1.0.2.tar.gz
- Upload date:
- Size: 14.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ffe9246489ee2423e40501114164440d4a2e42f17e22d40a339db8f571048d5 |
|
MD5 | 4538edf02e157d015123954fb0e21545 |
|
BLAKE2b-256 | 122a24c2ef33e3f8b590311bbf7e27f7965599a75658a38a2668218b69082419 |
File details
Details for the file jiushu_logger_flask-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: jiushu_logger_flask-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 956cb7716932a4e6ec46b44eef6aec4dd92ff56e304ffeb68672f30ea01e0225 |
|
MD5 | 82067bbcb1b46c6d5f7a4dec0ed4518e |
|
BLAKE2b-256 | c265d0947f1d7d54d17ab234b9f039fb751ebbdaed4d734119bbfd64f92db0ef |