Skip to main content

charlogger

A logging library for Python.

I've been using this myself for a while, and I thought that I may as well release it.

It's filled with bad code, but now that it is public, I'll probably improve it over time.

logger example

Installation

You can install charlogger with pip install charlogger.

How to use

Simple example

import charlogger

logger = charlogger.Logger()
logger.info("What a great logging library!")

Advanced example

import charlogger

# All parameters are optional.
logger = charlogger.Logger(
    debug=True, # Whether to enable the output of debug logs
    default_prefix="your prefix",
    color_text=False, # Whether to have the info text be colored
    log_file_patj=open("log.txt", "a"), # The file to put logs in
    indent_level=8, # The indentation of the text when output.
    centered=True # Whether to center text in the console.
)

logger.info("What a great logging library!")

My personal configuration (best)

import charlogger

logger = charlogger.Logger(
    debug=True,
    default_prefix="<TIME> | WORKER-001",
    color_text=True
)
logger.info("What a great logging library!")

More in-depth documentation

defaultPrefix

When initializing a Logger, you have the option of default_prefix.

For now, if you add "<TIME>" anywhere in that string, it will replace it with the time of the logging.

For instance, the following code will print 18:26:15 | hi! | i > What a great logging library!

import charlogger

logger = charlogger.Logger(
    debug=True,
    defaultPrefix="<TIME> hi!"
)
logger.info("What a great logging library!")

Logging methods

Possible arguments

import charlogger

logger = charlogger.Logger()
logger.info("What a great logging library!") # i > What a great logging library! 
logger.info(title="DOCUMENTATION", data="What a great logging library!") # i > [DOCUMENTATION] What a great logging library! 

All possible methods

import charlogger

logger = charlogger.Logger()
logger.info("What a great logging library!")
logger.warn("What a great logging library!")
logger.error("What a great logging library!")
logger.debug("What a great logging library!")
logger.valid("What a great logging library!")
logger.invalid("What a great logging library!")
logger.plus("What a great logging library!")
logger.paid("What a great logging library!")

Special methods

import charlogger

logger = charlogger.Logger()

# I can't imagine this one being all that useful. It's more there for my personal projects that use it,
logger.choice(1, "Option 1") # 1 > Option 1 

# Will wait for user input in the console.
name = logger.ask("What is your name?") # ? > What is your name? > 
print(name)

Metadata

Release files for charlogger 1.2.1

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

Source distribution (sdist)

Source distribution for charlogger 1.2.1
File Size Uploaded Provenance Actions
charlogger-1.2.1.tar.gz 3.4 kB Without provenance Details for charlogger-1.2.1.tar.gz

Release files / charlogger-1.2.1.tar.gz

Download URL charlogger-1.2.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
c3c461c7868d5c2a46353c0978d1a5ff92a53d7a6bce1b03a6cf8e6ceb97ee62
BLAKE2b-256 checksum
How to use checksums
6d5dff7564da36ccbb61a729e68dbaf65ae6757bbc8ebed2c129aa2f9b4f7843
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for charlogger 1.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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