Skip to main content

LogAid

Pypi version Python versions License

LogAid is a Python library designed to make logging enjoyable.

Have you ever felt too lazy to configure a proper logger and just defaulted to using print()? I know I have. But logging is crucial for any application and really simplifies debugging. With LogAid, you’ve got no excuse not to log from the start—it’s as easy as from logaid import logger.

This library aims to ease the pain of Python logging by offering a range of helpful features that address the common pitfalls of standard loggers. Logging in your app should be second nature, and LogAid strives to make that process both easy and powerful.


wait development

1. add jsonlogger

Installation

pip install logaid

Usage

just print

import logaid as log

log.debug('hello world')
log.info('hello world')
log.warning('hello world')
log.success('hello world')
log.error('hello world')
log.fatal('hello world',123,{},[],False)

or

import logaid

logaid.info('hello world')
logaid.warning('hello world')
logaid.error('hello world')
logaid.fatal('hello world',123,{},[],False)

image

click jump into code line

image

open super print

from logaid import log
log.init(print_pro=True)

print("Hello World")

image

auto_save

from logaid import log
log.init(level='DEBUG',save=True)

log.info('hello world')

save as filename and not print

from logaid import log
log.init(level='DEBUG',filename='test.log',show=False)

log.info('hello world')

define format

from logaid import log
log.init(level='INFO',format='%(asctime)s %(levelname)s %(pathname)s %(lineno)d: %(message)s')

log.info('hello world')

image

Split the log files by day

from logaid import log
log.init(filename='test.log',rotating='day')
log.info('hello world')

define color

from logaid import log
color = {
    'DEBUG':'gray',
    'INFO':'green',
    'WARNING':'yellow',
    'ERROR':'red',
    'FATAL':'violet',
}
log.init(level='DEBUG',color=color)

log.debug('hello world')
log.info('hello world')
log.warning('hello world')
log.error('hello world')
log.fatal('hello world',123,{},[],False)

image

send email

from logaid import log
mailer = {
        'host': 'smtp.qq.com',      
        'token': 'xxxxxxxxxxxx',    # IMAP/SMTP code
        'nickname':'LogAid',    
        'sender': 'xxxxxx@qq.com',
        'receivers': ['xxxxxx@qq.com'],
        'subject': 'A log aid for you.',
        'open_level': ['ERROR','FATAL']   # More than WARNING valid.
    }
log.init(level='ERROR',mailer=mailer)

log.error('Exec appear error.')
log.email('Send email tip.')

Release files for logaid 1.5.3

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

Source distribution (sdist)

Source distribution for logaid 1.5.3
File Size Uploaded
logaid-1.5.3.tar.gz 9.3 kB Details

Built distribution (wheel)

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

Total release size: 18.2 kB

Release files / logaid-1.5.3.tar.gz

Download URL logaid-1.5.3.tar.gz
Size 9.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0513e07b06a00b8b8f6e098a72d9838b76f5c76832f4150df1a7a87a93f98614
BLAKE2b-256 checksum
How to use checksums
c7f84f9c1e5c934cbac3795c95a6b1dd9749e8be2ca2ef687e1c345687a0a25c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release files / logaid-1.5.3-py3-none-any.whl

Download URL logaid-1.5.3-py3-none-any.whl
Size 8.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
df3021bb275bd501b03e06d66fefc74c7d1c56c671d522c54448a9dcbd56d8b5
BLAKE2b-256 checksum
How to use checksums
28c9c077d69d21e59e93566c2f2936fafee86460505efacef78b922159eaed4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

1.5.3 This release

2 release files

1.5.2

2 release files

1.5.1

2 release files

1.5.0

2 release files

1.4.0

2 release files

1.3.9

2 release files

1.3.8

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.9

2 release files

1.2.8

2 release files

1.2.6

2 release files

1.2.5

2 release files

1.2.4

2 release files

1.2.3

2 release files

1.2.2

2 release files

1.2.0

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.2

2 release files

1.1.0

2 release files

1.0.8

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.3

2 release files

1.0.2

2 release files

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