实现对logging的简单扩展
Project description
Documentation
The documentation is hosted at https://github.com/BingerYang/logger_app
Installation
pip install logger_app
Usage
example:
# -*- coding: utf-8 -*-
from logger_app import FormatterRule, LoggerApp
from flask import request, Flask
app = Flask(__name__)
app.config['PROPAGATE_EXCEPTIONS'] = False # 设置是否传递异常 , 如果为True, 则flask运行中的错误会显示到网页中, 如果为False, 则会输出到文件中
# FormatterRule.CB_TAG_MAP = dict(path=lambda: request.path, md5=lambda: request.host_url)
@app.route('/')
def index():
# num = 1 / 0
app.logger.error('this is a error')
return "index"
if __name__ == '__main__':
app.logger = LoggerApp(__name__, fmt=FormatterRule(style='json')).create_logger()
app.run(debug=True)
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file logger_app-0.0.2.23091422-py2.py3-none-any.whl.
File metadata
- Download URL: logger_app-0.0.2.23091422-py2.py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df18fa4c965e6841f4c1ebd2bdb3581c0ecd135bd3b12fd3d06d5d883aa16ffc
|
|
| MD5 |
88e3258015a7707ecfe2e5368d6619ff
|
|
| BLAKE2b-256 |
7e2b6cbeecda2c4ed726f215fc09213cb1db941c0795879e769c510f1019a50b
|