Skip to main content

A log aid for you.

Project description

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')

Split the log files by day

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

image

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.')

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

logaid-1.5.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

logaid-1.5.1-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file logaid-1.5.1.tar.gz.

File metadata

  • Download URL: logaid-1.5.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for logaid-1.5.1.tar.gz
Algorithm Hash digest
SHA256 7207c025d1fe78e209fc5b01c366b33a0d7228789d611134396f3240713a07d3
MD5 d7b62f4003adcd503575271b3dace7fc
BLAKE2b-256 f2668c9ac83e5b14f3acbaf7a9cf6036fa1244318bd0b00fe2b84629442a8114

See more details on using hashes here.

File details

Details for the file logaid-1.5.1-py3-none-any.whl.

File metadata

  • Download URL: logaid-1.5.1-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for logaid-1.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 058563f7fe57d0d7cb9142359d3e18e140991b8483cc6956a7468d60077f3758
MD5 dd59e23dc202a8d5a049fde16a99217d
BLAKE2b-256 9b07f6800343552d221a631fc7d5b66f44baf8d25e6d686fad3e4ae700bc7da3

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