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.1.tar.gz
(15.4 kB
view details)
Built Distribution
File details
Details for the file jiushu_logger_flask-1.0.1.tar.gz
.
File metadata
- Download URL: jiushu_logger_flask-1.0.1.tar.gz
- Upload date:
- Size: 15.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a90b86e3518532c8d0c2ddfd5b1b88fc018c1dc1eab988200c4090b554461fa |
|
MD5 | 108191608cd25abccb2d9f4981e6d1a7 |
|
BLAKE2b-256 | cd53fe436934305acc214a9631c8b346efca5f47dcd73acc73152e98f6b3161a |
File details
Details for the file jiushu_logger_flask-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: jiushu_logger_flask-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.31.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a5e0a382d23fc80d70da12c5bdeb75651da7e31497ada0e6aa0a2c75eaced1f |
|
MD5 | a98b3368400dcfee2f62c81a5afdac29 |
|
BLAKE2b-256 | 74a91bdcda03be2eca5cc829b5691d0170bc75483c34c639acd36f2ef71c2aa6 |