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

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

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.2.tar.gz (9.1 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.2-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logaid-1.5.2.tar.gz
  • Upload date:
  • Size: 9.1 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.2.tar.gz
Algorithm Hash digest
SHA256 fb2f8ec01f8ef45f6deb276ecf0e9c485cca3a6f7a727e0e379e5f5f9268331a
MD5 6b092185e0d0b71c6997b791a347abff
BLAKE2b-256 d8d7876ad29beed7c9c72849d872f3f505d252648cab8937b3a2c27e28c07d0f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logaid-1.5.2-py3-none-any.whl
  • Upload date:
  • Size: 8.8 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6368776b61329b06fb0a69d81a16766406dd895529820210fb49ed289fd94de4
MD5 43c8a94c2a62c3869c5214b2740e6df8
BLAKE2b-256 ce5fb3733038caf99ab0bbd3567e983917e521fba3f52f2df8b32635745e984d

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