Skip to main content

实现对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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

logger_app-0.0.1.20020712.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

logger_app-0.0.1.20020712-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file logger_app-0.0.1.20020712.tar.gz.

File metadata

  • Download URL: logger_app-0.0.1.20020712.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4

File hashes

Hashes for logger_app-0.0.1.20020712.tar.gz
Algorithm Hash digest
SHA256 8e5faf70ba907c9b8b4b80ee80c3f34183c1e235e6fe65523f6b838818ba2d13
MD5 aeb055512e70e0b7f110940646e4e63b
BLAKE2b-256 bcd5f3a898c2ffefcc19d98ab99f7fc0aa92d17dd7ec518f4e86e93a53162442

See more details on using hashes here.

File details

Details for the file logger_app-0.0.1.20020712-py3-none-any.whl.

File metadata

  • Download URL: logger_app-0.0.1.20020712-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.4

File hashes

Hashes for logger_app-0.0.1.20020712-py3-none-any.whl
Algorithm Hash digest
SHA256 e1ff16ee1f5e6cde00bbf4857527fb7730acb0000dd838d850bf0b52d5ab3b46
MD5 7be32557443a513f67e928bf4251387c
BLAKE2b-256 1525b9333751d261542c39a0b6d7ae4620edc178669a5548e9b25b7e9ca19a86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page