Skip to content

Logger

veltix.logger.core.Logger

Thread-safe singleton logger with console and file output.

Can be passed to Client/Server or used standalone.

get_instance classmethod

get_instance(
    config: Optional[LoggerConfig] = None,
) -> Logger

Get or create the singleton instance.

configure

configure(config: LoggerConfig) -> None

Reconfigure the logger with a new config (writer, formatter, stats reset).

reset_instance classmethod

reset_instance() -> None

Reset the singleton (mainly for testing).

veltix.logger.config.LoggerConfig dataclass

Configuration for Veltix logger.

Attributes:

Name Type Description
level LogLevel

Minimum log level to display

enabled bool

Enable/disable all logging

use_colors bool

Enable colored output for console

show_timestamp bool

Show timestamp in logs

show_caller bool

Show file:line information

show_level bool

Show log level name

file_path str | Path | None

Path to log file

file_rotation_size int

Max file size in bytes before rotation

file_backup_count int

Number of backup files to keep

stream TextIO

Output stream for console logs

async_write bool

Use async file writing for performance

buffer_size int

Buffer size for async writes

__post_init__

__post_init__()

Validate and normalize configuration.

veltix.logger.levels.LogLevel

Bases: IntEnum

Log severity levels.

Levels are ordered by severity, allowing simple filtering: - TRACE: Detailed debugging information - DEBUG: General debugging information - INFO: Informational messages - SUCCESS: Successful operations (between INFO and WARNING) - WARNING: Warning messages for potential issues - ERROR: Error messages for failures - CRITICAL: Critical errors requiring immediate attention

__str__

__str__() -> str

Return level name.