log11
A simple logging library built on top of loguru.
Installation
pip install log11
Quick Start
from log11 import get_logger
# Get the default logger
logger = get_logger()
# Log messages
logger.info("Application started")
logger.warning("This is a warning")
logger.error("Something went wrong")
Advanced Configuration
Different Output Formats and Sinks
from log11 import Log, TextFormatConfig
import sys
# Clear any existing configuration
Log.clear()
# 1. JSON output to file
Log.add_output(
name="file_json",
sink="logs/app.log",
data_format="json",
level="INFO"
)
# 2. Plain text output to file
Log.add_output(
name="file_text",
sink="logs/app.txt",
data_format="text",
colored=False,
level="DEBUG"
)
# 3. Colored text output to console
Log.add_output(
name="console_colored",
sink=sys.stdout,
data_format="text",
colored=True,
level="INFO",
text_format_config=TextFormatConfig(
date=False,
time=True,
level=True,
location=True,
function=True,
message=True,
extras=True
)
)
# Get logger with all outputs configured
logger = get_logger()
# Log messages - they'll appear in all configured outputs
logger.info("User logged in", user_id=123, username="alice")
logger.debug("Debug information", debug_data={"key": "value"})
Environment-Specific Configuration
from log11 import Log, TextFormatConfig
import sys
import os
# Clear any existing configuration
Log.clear()
if os.getenv("ENV") == "production":
# Production: JSON to file only
Log.add_output(
name="production",
sink="logs/production.log",
data_format="json",
level="INFO"
)
else:
# Development: Colored text to console
Log.add_output(
name="development",
sink=sys.stdout,
data_format="text",
colored=True,
level="DEBUG",
text_format_config=TextFormatConfig(
date=False,
time=True,
level=True,
location=True,
function=True,
message=True,
extras=True
)
)
logger = get_logger()
logger.info("Environment-specific logging")
## API Reference
### Log
The main logging configuration manager.
- `Log.clear()`: Clear all output configurations
- `Log.default_setup()`: Setup default console logging
- `Log.add_output(name, sink, data_format, colored, level, text_format_config, **kwargs)`: Add a new output configuration
- `Log.add_level(name, number, color)`: Add a custom logging level
- `Log.set_global_level(level)`: Set logging level for all outputs
### get_logger
- `get_logger()`: Get a configured logger instance (sets up defaults if needed)
### Configuration Classes
- `TextFormatConfig(date, time, level, location, function, message, extras)`: Configure text output format
- `TextFormat(config)`: Text formatter implementation
- `LogColor`: Color constants for styling
- `LogStyle`: Text styling helpers
- `LogField`: Field rendering utilities
Metadata
Release files for log11 0.1.11
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| log11-0.1.11.tar.gz | 42.9 kB | Without provenance | Details for log11-0.1.11.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| log11-0.1.11-py3-none-any.whl | Python 3 | none | any | Details for log11-0.1.11-py3-none-any.whl |
Total release size: 49.4 kB
Release files / log11-0.1.11.tar.gz
| Download URL | log11-0.1.11.tar.gz |
|---|---|
| Size | 42.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b4f072fc51023e0a9b7606a4e3b0cafcc7272d0602abec925ec2fcea42cd04ad
|
|
BLAKE2b-256 checksum How to use checksums |
f6dfacc6ccb8fb7e1ea9cdd9e9ec1d407dde28f49d552f864adf55359fd7b5d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Release files / log11-0.1.11-py3-none-any.whl
| Download URL | log11-0.1.11-py3-none-any.whl |
|---|---|
| Size | 6.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b14f67497afe563a8f491b12b704caa0ccfb2f7a3f5555bd40316059fa2fcf26
|
|
BLAKE2b-256 checksum How to use checksums |
631bdd592b211f7e031df583d53f0e26a9d315246c99570139bab5ffe31188de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.9
|
Security for log11 0.1.11
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.