Skip to main content

A beautiful, colorful Python logging library by karenhoyoshi

Project description

logkaren

A beautiful, colorful Python logging library by karenhoyoshi

PyPI version Python License: MIT


Installation

pip install logkaren

Quick Start

from logkaren import Logger, Loader, Home, LogLevel

# Default ColorLogger
log = Logger()
log.info("Server started on port 8080")
log.success("User logged in successfully")
log.warning("Disk usage above 80%")
log.error("Connection refused")
log.debug("Variable x = 42")

# With timing
import time
start = time.time()
time.sleep(0.5)
end = time.time()
log.success("Task done", start=start, end=end)

# Ask user input
name = log.question("What is your name? ")

# Critical — pauses and exits
log.critical("Fatal error occurred", exit_code=1)

Logger Styles

Style 1 — ColorLogger (default)

log = Logger()           # or Logger(style=1)

Colorful output with pink prefix, magenta timestamps, and colored log levels.

Style 2 — SimpleLogger

log = Logger(style=2)

Clean minimal output — great for production or CI environments.


Constructor Options

Logger(
    style=1,                          # 1 = ColorLogger, 2 = SimpleLogger
    prefix="karenhoyoshi.asia",       # Custom prefix shown in brackets
    github_repository="github.com/karenhoyoshi/myproject",  # Shown on startup
    level=LogLevel.DEBUG,             # Minimum log level to display
    log_file="logs/app.log",          # Optional file to save logs
)

Log Levels

Level Value Description
DEBUG 1 Detailed debug information
INFO 2 General information
WARNING 3 Something unexpected but non-fatal
SUCCESS 4 Operation completed successfully
FAILURE 5 Operation failed
CRITICAL 6 Fatal error — exits the program
from logkaren import Logger, LogLevel

# Only show WARNING and above
log = Logger(level=LogLevel.WARNING)

Loader

Animated terminal spinner for long-running tasks.

from logkaren import Loader
import time

# As context manager (recommended)
with Loader(desc="Fetching data from API", end="Done fetching!"):
    time.sleep(3)

# Manual control
loader = Loader(desc="Processing files")
loader.start()
time.sleep(2)
loader.stop()

Options:

Param Default Description
prefix karenhoyoshi.asia Prefix shown in the spinner
desc Loading... Description text next to the spinner
end \r Message shown when done (or \r)
timeout 0.1 Speed of animation (seconds per frame)

Home Screen

Display a styled ASCII banner at startup.

from logkaren import Home

Home(
    title="MYAPP",
    subtitle="The coolest tool ever",
    credits="by karenhoyoshi",
    adinfo1="v2.0.0",
    adinfo2="github.com/karenhoyoshi/myapp",
    clear=True,   # Clear terminal before displaying
).display()

Requires pyfiglet for the big ASCII title font (installed automatically).


Logging to File

log = Logger(log_file="logs/app.log")
log.info("This will be saved to file too")

ANSI color codes are automatically stripped from file output.


License

MIT © karenhoyoshi

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

logkaren-1.0.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

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

logkaren-1.0.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file logkaren-1.0.0.tar.gz.

File metadata

  • Download URL: logkaren-1.0.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for logkaren-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f24f9c0cd050c73f310dce7f2f89019f2e82c6aadc88ac1ff7a6186f861f84dc
MD5 b3255e9204f9ba8c7d734ae2a383146c
BLAKE2b-256 4583271efac68ec2e160a3a30eae99c63aa9adfd257f5b1b9dea731ee0c883bc

See more details on using hashes here.

File details

Details for the file logkaren-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: logkaren-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for logkaren-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6cf788b25305c061adfe035529f0235014faab9acdd2559f34d21bab3fee6bbd
MD5 d7e7377eaa498c02d30f844cc2af6f82
BLAKE2b-256 eec06273df9aaeb844dec8b36b3ad0c0b7d612faeb76d07e5b167da28c12aad7

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