Skip to main content

A lightweight and easy-to-use logging library for Python.

Project description

🐱‍👓 cobra-log 🐱‍👓

PyPI version Python codecov License

Tests Github stars

About

A lightweight and easy-to-use logging library for Python.

  • Python: 3.9+

Features

  • 🚀 Seamless integration with Python's native exception mechanism.
  • 🚀 Vivid and detailed terminal output (need cobra-color).
  • 🚀 User-friendly log file management.

Installation

Stable (once published):

pip install cobra-log

Quick Start

  • Simple warning

    from cobra_log import warning, use_logger
    
    use_logger("your_log_file.log")
    
    warning("warning message")
    

Example

from cobra_log import (use_logger, info, warning, error)

# initialize and activate loggers
use_logger("my_logger_1", "stdout", "console")
use_logger("my_logger_2", "log_save_path.log", ("stdout", "error"))
# use my_logger_2
try:
    try:
        try:
            1 / 0
        except Exception as e:
            raise error("An error occurred.", throw=None) from e
    except Exception as ee:
        raise error(
            "An error(TimeoutError) occurred.",
            throw=TimeoutError
        ) from ee
except Exception:
    critical("A critical error occurred.", throw=None)
# activate my_logger_1
use_logger("my_logger_1")
# use my_logger_1
warning("A warning occurred.")
info("An info occurred.")

Requirements

  • Python >= 3.9
  • (Optional) cobra-color >= 1.3.0

License

See LICENSE in the repository.

Links

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

cobra_log-2.0.0.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

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

cobra_log-2.0.0-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file cobra_log-2.0.0.tar.gz.

File metadata

  • Download URL: cobra_log-2.0.0.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for cobra_log-2.0.0.tar.gz
Algorithm Hash digest
SHA256 03644093858a39a505988fce40929e12370265b9b85744bbff28e7e02045a0a9
MD5 9b09655dfa659a62aea93c9a45788d6e
BLAKE2b-256 a0e5ff60fea1f9712e221094e0758671fab502cdc0fbc814bc4652e29bebad19

See more details on using hashes here.

File details

Details for the file cobra_log-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: cobra_log-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.10

File hashes

Hashes for cobra_log-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 89499754dc4f2712b32df0fb48b06ff5467d339deba5364e290405caef9be943
MD5 6e81209669af7a0db39495d7a0219cfc
BLAKE2b-256 7efdd7a3e5d693d13497b2da33ce2282a389b430b67f2cb2878280af108c8f74

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