Skip to main content

Simple python3 custom rich logger ready to go.

Project description

R2Log - Ready To Log

PyPI Python Twitter

Custom overload of the python logger to integrate additional levels (verbose, advanced, success) by integrating Rich for advanced rendering (color, emoji, etc.).

Easy to deploy in a project and to use, ready to go.

Installation

Add R2Log to your requirements.txt file and pip3 install R2Log on your dev env.

How to use

Initialization

from R2Log import logger

logger.setVerbosity(0)  # Default INFO level 
logger.setVerbosity(1)  # Set VERBOSE level 
logger.setVerbosity(2)  # Set ADVANCED level 
logger.setVerbosity(3)  # Set DEBUG level 

logger.setVerbosity(quiet=True)  # Set CRITICAL level 

Log messages by level

from R2Log import logger

logger.setVerbosity(3)

logger.debug("Debug")
logger.advanced("Advanced")
logger.verbose("Verbose")
logger.info("Info")
logger.success("Success")
logger.warning("Warning")
logger.error("Error")
logger.critical("Critical")

Demo log levels

Nice to have

from R2Log import logger, R2Log

logger.setVerbosity(1)
logger.raw("""Raw text or byte 
or complex string with special char""")
logger.empty_line()
logger.empty_line()
logger.raw(level=R2Log.DEBUG, msg="""Debug but 
with a custom level""")
logger.raw(level=R2Log.INFO, msg="""Other INFO raw message but 
with a custom level""")

Demo Raw logs

Argparse argument and level init

import argparse, sys
from R2Log import logger

parser = argparse.ArgumentParser()
parser.add_argument("-v", "--verbose",
                    action="count",
                    default=0,
                    help="Verbosity level (-v for verbose, -vv for advanced, -vvv for debug)")
if len(sys.argv) == 1:
    parser.print_help()
    sys.exit(1)

args = parser.parse_args()
logger.setVerbosity(args.verbose)

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

r2log-1.0.2.tar.gz (41.0 kB view details)

Uploaded Source

Built Distribution

R2Log-1.0.2-py3-none-any.whl (28.6 kB view details)

Uploaded Python 3

File details

Details for the file r2log-1.0.2.tar.gz.

File metadata

  • Download URL: r2log-1.0.2.tar.gz
  • Upload date:
  • Size: 41.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for r2log-1.0.2.tar.gz
Algorithm Hash digest
SHA256 9b19c032df840bab91b5cae2fb20cda22b15dd82e00bf1b82d78a0d0832ffbb3
MD5 26f2f1aa31ff4a005b90aba8f743d7f8
BLAKE2b-256 e415c23debefe8ba0cce73391b8045dafd5a1ac5913a3f8ad797da27477dba9f

See more details on using hashes here.

File details

Details for the file R2Log-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: R2Log-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 28.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for R2Log-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4954c1ee6fc95c3bb0246a40595d9016032c7815cc43b77c909d15e7d0244b76
MD5 3a4ed0a315c8191cdb380c9f1d83e7da
BLAKE2b-256 33a5631bc4b044d909b71355807f64819c6d16eac7ec6a6b6413ba85f02f5960

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page