Skip to main content

Aelog

An simple, async, full package name path, log rotating, different colored log library.

aelog aims to make using python log as simple as possible. as a result, it drastically simplifies using python logging.

aelog's design objectives:

  • Make using python log as simple as possible.
  • Output log contains the full package name path.
  • Provide asynchronous log output function, at the same time, contains common log output.
  • Output according to the log level to mark the different colors separately.
  • Provide a log file rotating, automatic backup.
  • Output to the terminal and file, default output to the terminal, if you don't provide the log file path.

Installing aelog

  • pip install aelog

init aelog

import aelog 

app = Flask(__name__)

aelog.init_app(app)
# or 
aelog.init_app(aelog_access_file='aelog_access_file.log', aelog_error_file='aelog_error_file.log', 
               aelog_console=False)

aelog config

List of configuration keys that the aelog extension recognizes:

configuration key the meaning of the configuration key
AELOG_ACCESS_FILE Access file path, default None.
AELOG_ERROR_FILE Error file path, default None.
AELOG_CONSOLE Whether it is output at the terminal, default false.
AELOG_LEVEL log level, default 'DEBUG'.
AELOG_MAX_BYTES Log file size, default 50M.
AELOG_BACKUP_COUNT Rotating file count, default 5.

Usage

simple using, output log to terminal.

import aelog

aelog.init_app(aelog_console=True)

def test_aelog_output_console():
    """

    Args:

    Returns:

    """
    aelog.debug("simple debug message", "other message")
    aelog.info("simple info message", "other message")
    aelog.warning("simple warning message", "other message")
    aelog.error("simple error message", "other message")
    aelog.critical("simple critical message", "other message")
    try:
        5 / 0
    except Exception as e:
        aelog.exception(e)

This will output to the terminal.
console

  • Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.

output log to file and terminal.

import aelog
from flask import Flask

app = Flask(__name__)

aelog.init_app(app)  # Output to the test.log file and terminal 

def test_aelog_output_file():
    """

    Args:

    Returns:

    """
    aelog.debug("simple debug message", "other message")
    aelog.info("simple info message", "other message")
    aelog.warning("simple warning message", "other message")
    aelog.error("simple error message", "other message")
    aelog.critical("simple critical message", "other message")
    try:
        5 / 0
    except Exception as e:
        aelog.exception(e)

This will output to the test.log file and terminal. console

  • Automatic output is greater than the error information to the 'test_error.log' file.
  • Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.

asynchronous output log to file and terminal.

import asyncio
import aelog
from sanic import Sanic

app = Sanic(__name__)

aelog.init_aelog(app)  # Output to the test.log file and terminal 

async def test_async_output():
    await aelog.async_debug("simple debug message", "other message")
    await aelog.async_info("simple info message", "other message")
    await aelog.async_warning("simple warning message", "other message")
    await aelog.async_error("simple error message", "other message")
    await aelog.async_critical("simple critical message", "other message")
    try:
        5 / 0
    except Exception as e:
        await aelog.async_exception(e)

if "__name__"=="__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(test_async_output())

This will output to the test.log file and terminal. console

  • Automatic output is greater than the error information to the 'test_error.log' file.
  • Different levels of logging, different color, the color is cyan, green, yellow, red and 'bold_red,bg_white' in turn.

Metadata

Release files for aelog 1.0.9

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

Built distribution (wheel)

Table of built distributions (wheels) for aelog 1.0.9
File Interpreter ABI Platform
aelog-1.0.9-py3-none-any.whl Python 3 none any Details

Release files / aelog-1.0.9-py3-none-any.whl

Download URL aelog-1.0.9-py3-none-any.whl
Size 7.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8ac17de13b60256bebcd82cd11910c52a4ac7cfc90da300199df36c0a9f79d5f
BLAKE2b-256 checksum
How to use checksums
863674695587078f5101f2b7cefed205ace2ba29efcde85ddf6e7cd8c235a7d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.9

Security for aelog 1.0.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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