https://github.com/accelbyte/justice-python-common-log
https://github.com/accelbyte/justice-python-common-log
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/accelbyte/justice-python-common-log
- Owner: AccelByte
- License: other
- Created: 2022-01-11T08:04:35.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-01-02T03:27:07.000Z (over 1 year ago)
- Last Synced: 2025-01-02T04:21:33.826Z (over 1 year ago)
- Language: Python
- Size: 54.7 KB
- Stars: 0
- Watchers: 5
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Authors: AUTHORS.rst
Awesome Lists containing this project
README
=========================
justice-python-common-log
=========================
.. image:: https://img.shields.io/pypi/pyversions/justice_python_common_log
:target: https://pypi.python.org/pypi/justice_python_common_log
:alt: Python Version
.. image:: https://img.shields.io/pypi/l/justice_python_common_log
:target: https://github.com/AccelByte/justice-python-common-log/blob/main/LICENSE
:alt: License
Justice common log format for python
* Free software: Apache Software License 2.0
Usage in flask
~~~~~~~~~~~~~~
**Basic**
.. code:: python
import flask
from justice_python_common_log.flask import Log
app = flask.Flask(__name__)
Log(app)
**Exclude specific endpoint**
.. code:: python
Log(app, excluded_paths=['/swaggerui.*', '/analytics/apidocs'])
**Exclude specific agent**
.. code:: python
Log(app, excluded_agents=['ELB'])
Usage in FastAPI
~~~~~~~~~~~~~~
**Basic**
.. code:: python
from fastapi import FastAPI
from justice_python_common_log.fastapi import Log
app = FastAPI()
Log(app)
**Exclude specific endpoint**
.. code:: python
Log(app, excluded_paths=['/swaggerui.*', '/game-telemetry/apidocs'])
**Exclude specific agent**
.. code:: python
Log(app, excluded_agents=['ELB'])
Environment variables
~~~~~~~~~~~~~~~~~~~~~
**FULL_ACCESS_LOG_ENABLED**
: Enable full access log mode. Default: *false*.
**FULL_ACCESS_LOG_SUPPORTED_CONTENT_TYPES**
: Supported content types to shown in request_body and response_body log.
Default:
*application/json,application/xml,application/x-www-form-urlencoded,text/plain,text/html*.
**FULL_ACCESS_LOG_MAX_BODY_SIZE**
: Maximum size of request body or response body that will be processed,
will be ignored if exceed more than it. Default: *10240 bytes*