Skip to main content

flask-logfile

一个高可用的Flask日志文件插件

安装

pip install flask_logfile

示例

import logging

from flask import Flask
from flask_logfile import LogFile


app = Flask(__name__)

app.config['LOG_LEVEL'] = logging.INFO
app.config['LOG_FILE'] = '`logs/main.log`'

LogFile().init_app(app)

app.logger.debug('debug')
app.logger.info('info')
app.logger.warning('warning')
app.logger.error('error')

配置说明

配置变量 功能说明
LOG_LEVEL 日志等级,同logging模块,默认:DEBUG
LOG_DATE_FORMAT 日志时间格式,默认:%Y-%m-%d %H:%M:%S
LOG_STREAM_FORMAT 控制台日志格式,可参考官方文档
LOG_FILE 日志文件路径,默认:logs/flask.log
LOG_FILE_ENCODING 日志文件编码,默认:utf8
LOG_FILE_FORMAT 日志文件日志格式,可参考官方文档
LOG_FILE_SPLIT_UNIT 日志文件拆分时间单位,默认:d(天)
FILE_SPLIT_INTERVAL 日志文件拆分间隔,默认:1个时间单元
LOG_FILE_BACKUP_COUNT 日志文件备份数量,默认:0

Metadata

Release files for flask-logfile 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flask-logfile 0.0.2
File Size Uploaded
flask-logfile-0.0.2.tar.gz 3.4 kB Details

Release files / flask-logfile-0.0.2.tar.gz

Download URL flask-logfile-0.0.2.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
194bdf321fb2bd6ee2331f429cf15e0c03580d690cd9c8ecf15c6c9e0134c700
BLAKE2b-256 checksum
How to use checksums
e7d148f0ef8e0959a955a0d4c2f37cdda0e0b950d03c1515fc0d955dedda0b19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.0 CPython/3.8.5

Release history Release notifications | RSS feed

This release

0.0.2 This release

1 release file

0.0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page