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.1.tar.gz (10.8 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.1-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: logkaren-1.0.1.tar.gz
  • Upload date:
  • Size: 10.8 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.1.tar.gz
Algorithm Hash digest
SHA256 12c0f51e6ca883aa884c2365e178813d3089f6d633b5f1e83881ae1cde6d5d30
MD5 ec691060e4a56a162b564ed8d5f1aca3
BLAKE2b-256 e74151a06e918ed622d162b93c9310cd32b1a4f62d456a0c95603eebd0d2f785

See more details on using hashes here.

File details

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

File metadata

  • Download URL: logkaren-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.9 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d7ba445b9dfaba39d6c6f4c389ad76c4214ca3218fa8e208d4f018e78b93a81c
MD5 ba0a2a25a111aed3b224db9ee5cc079d
BLAKE2b-256 90169ee7d6faa367eebf4be29579eadf44fc6ace4a3e3cdafba4b608e91a38a3

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