"""
PLogger - A Universal Performance Logging Utility for Python.

Provides the `PLogger` class for thread-safe logging to CSV files with
intelligent, metric-based rotation strategies. Ideal for collecting
performance metrics, experimental results, or any structured data
where it's important to preserve unique values (outliers) while
managing log size.

Key Features:
- Thread-safe writes for use in concurrent applications.
- Multiple rotation strategies:
  - `fifo`: Standard first-in, first-out.
  - `by_metric`: Keeps outliers by removing entries with the smallest metric difference to their neighbors.
  - `by_group_metric`: Applies `by_metric` logic within the largest group of entries.
- Simple, dictionary-based logging.
- Automatic creation of log files and directories.

Basic Usage:
------------
from pathlib import Path
from plogger import PLogger

# Initialize the logger
logger = PLogger(
    log_path=Path("performance_logs.csv"),
    header=["request_id", "latency_ms"],
    max_entries=100,
    rotation_strategy='by_metric',
    metric_column='latency_ms'
)

# Log data
logger.log({"request_id": "abc-123", "latency_ms": 150.5})
"""
from importlib import metadata

from .plogger import PLogger

try:
    # This will read the version from the installed package's metadata
    __version__ = metadata.version("plogger")
except metadata.PackageNotFoundError:
    # This happens when the package is not installed, e.g., when running tests
    # or in a development environment.
    __version__ = "0.0.0-dev"

__all__ = ["PLogger"]
