Skip to main content

Korean-friendly logging utility with abbreviated levels and Korean timezone

Project description

K-Logger

A Python logging utility optimized for Korean developers with automatic Korean timezone (KST) support and customizable formatting.

PyPI version Python Support License: MIT

🇰🇷 한국어 버전

Features

  • 🕐 Automatic Korean Timezone (KST) - All timestamps are automatically converted to Korean time
  • 🔤 Abbreviated Log Levels - Clean, single-letter log level indicators (D, I, W, E, C)
  • 🎨 Flexible Formatting - Toggle file information display based on your needs
  • Easy Setup - Works out of the box with sensible defaults
  • 🐍 Pure Python - No system dependencies required
  • 📦 Lightweight - Minimal dependencies (only loguru and pytz)
  • 🖱️ IDE-Friendly - Clickable file paths in VSCode and other modern IDEs (format: file.py:line)

Installation

pip install k-logging

Quick Start

from k_logger import get_logger

logger = get_logger()

logger.info("Application started")
logger.warning("This is a warning")
logger.error("An error occurred")

Output:

I 05-23 14:30:15 | example.py:5 - Application started
W 05-23 14:30:15 | example.py:6 - This is a warning
E 05-23 14:30:15 | example.py:7 - An error occurred

💡 Pro tip: In VSCode and other modern IDEs, you can click on example.py:5 to jump directly to that line in your code!

Usage

Basic Usage

K-Logger automatically initializes with sensible defaults when you import it:

from k_logger import get_logger

logger = get_logger()
logger.info("Hello, World!")

Custom Configuration

You can customize the logger behavior using setup_korean_logger():

from k_logger import setup_korean_logger

# Show debug messages and include file information
logger = setup_korean_logger(level="DEBUG", show_file_info=True)

logger.debug("Debug message")
logger.info("Info message")
logger.warning("Warning message")
logger.error("Error message")
logger.critical("Critical message")

Minimal Format

For cleaner output without file information:

from k_logger import setup_korean_logger

# Simple format without file info
logger = setup_korean_logger(level="INFO", show_file_info=False)

logger.info("Clean log output")  # I 05-23 14:30:15 - Clean log output

Log Levels

Level Abbreviation Description
DEBUG D Detailed information for debugging
INFO I General informational messages
WARNING W Warning messages
ERROR E Error messages
CRITICAL C Critical issues

API Reference

setup_korean_logger(level="INFO", show_file_info=True)

Configure and return a logger instance with Korean timezone support.

Parameters:

  • level (str): Logging level ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL")
  • show_file_info (bool): Whether to include file path and line number in logs

Returns:

  • loguru.Logger: Configured logger instance

get_logger()

Get the current logger instance. If not configured, returns the auto-configured default logger.

Returns:

  • loguru.Logger: Current logger instance

Examples

Integration with Existing Projects

# myapp.py
from k_logger import get_logger

logger = get_logger()

def process_data(data):
    logger.debug(f"Processing {len(data)} items")
    try:
        # Process data here
        result = data.upper()
        logger.info("Data processed successfully")
        return result
    except Exception as e:
        logger.error(f"Failed to process data: {e}")
        raise

Multi-module Applications

# config.py
from k_logger import setup_korean_logger

# Configure once at application startup
logger = setup_korean_logger(level="DEBUG", show_file_info=True)

# other_module.py
from k_logger import get_logger

logger = get_logger()  # Gets the same configured instance
logger.info("Using logger in another module")

Requirements

  • Python 3.7+
  • loguru >= 0.6.0
  • pytz >= 2021.1

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Changelog

v1.0.0 (2025-05-23)

  • First stable release
  • Korean timezone support
  • Abbreviated log levels
  • Customizable formatting options
  • IDE-friendly clickable file paths

Acknowledgments

  • Built with loguru - Python logging made (stupidly) simple
  • Timezone support by pytz - World timezone definitions for Python

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

k_logging-1.0.0.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

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

k_logging-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: k_logging-1.0.0.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for k_logging-1.0.0.tar.gz
Algorithm Hash digest
SHA256 0dd019e0411859ecab99f92e07cd14ad56a1ffb96a10ca07e107f173c26ead85
MD5 3cd8b3bc65395cfb9ce5a950a69d24d5
BLAKE2b-256 3d9074eea7e54a710428dadcc62c3f79ab696381741c37e4707b3ef04bb8c9c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: k_logging-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.12

File hashes

Hashes for k_logging-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 cb2d3f7bfb9890bf738f3ece63181688e587a45dc9b60c1d437422e1ccb63dd1
MD5 fe48e2a2c480fa330241254fa6d647c0
BLAKE2b-256 69d7850de89e187c1d1af947a9b1d5a06a2df11d1f3bee59ccb2c3de3ff12fe2

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