Skip to content

Core Logger Interface

Main logging methods, configuration, and data handling with clean API separation.


BaseLogger

Python
BaseLogger()

Core logging interface with structured, colorized output

level

Python
level: LogLevel

Current logging level

mode

Python
mode: str

Current logging mode

run_id

Python
run_id: str

Current run ID

state

Python
state: dict

Complete logger state information

add_file

Python
add_file(filename: str, max_bytes: int = 10485760, backup_count: int = 5, level: logLevels = None, formatter=None)

Add a rotating file handler for log output

cdata

Python
cdata(data: Any, **kwargs) -> None

Log data in compact format

close

Python
close()

Close all handlers and clean up resources

configure

Python
configure(mode: Optional[Literal['terminal', 'json', 'compact']] = None, level: Optional[logLevels] = None, color_enabled: Optional[bool] = None, highlight_syntax: Optional[bool] = None, verbose: Optional[bool] = None, trace_enabled: Optional[bool] = None, deployment_mode: Optional[bool] = None, suppress_autoconfig: bool = True, prefix: object = _UNSET, show_thread_name: Optional[bool] = None) -> None

Configure logger behavior and settings

critical

Python
critical(*args: Any, header: Optional[str] = None, log_opts: Optional[Union[LogOptions, dict]] = None, **kwargs: Any) -> None

Log a CRITICAL-level message

cycle_run

Python
cycle_run()

Generate a fresh run ID — call at the start of each Lambda invocation or job cycle.

data

Python
data(obj: Any, compact: bool = False, **kwargs) -> None

Log objects in a visually formatted manner

debug

Python
debug(*args: Any, log_opts: Optional[Union[LogOptions, dict]] = None) -> None

Log a DEBUG-level message

error

Python
error(*args: Any, header: Optional[str] = None, log_opts: Optional[Union[LogOptions, dict]] = None, **kwargs: Any) -> None

Log an ERROR-level message

exception

Python
exception(*args: Any, header: Optional[str] = None, log_opts: Optional[Union[LogOptions, dict]] = None, **kwargs) -> None

Log an ERROR-level message with exception context

flush

Python
flush()

Flush all logger handlers

header

Python
header(text: str, size: int = None, compact=False, return_repr=False, level: logLevels = 'HEADER')

Create and log a formatted header

info

Python
info(*args: Any, header: Optional[str] = None, log_opts: Optional[Union[LogOptions, dict]] = None) -> None

Log an INFO-level message

initiate_new_run

Python
initiate_new_run()

Generate and assign a new run ID for process tracking

prefix

Python
prefix(value: str)

Scoped log prefix — use as a context manager or decorator.

As a context manager: with logger.prefix("api-handler"): logger.info("...") # shows prefix

As a decorator: @logger.prefix("MyService") def process(self): logger.info("...") # shows prefix for the whole call

reinitialize

Python
reinitialize(verbose=False)

Reload environment configuration and update logger settings

set_prefix

Python
set_prefix(prefix: Optional[str] = None) -> None

Set a contextual prefix prepended to all log output as [run_id | prefix | ...]

success

Python
success(*args: Any, header: Optional[str] = None, log_opts: Optional[Union[LogOptions, dict]] = None) -> None

Log a success message (alias for info)

temporary

Python
temporary(level: Optional[logLevels] = None, mode: Optional[Literal['terminal', 'json', 'compact']] = None, color_enabled: Optional[bool] = None, verbose: Optional[bool] = None, trace_enabled: Optional[bool] = None, highlight_syntax: Optional[bool] = None, deployed: Optional[bool] = None)

Temporarily override logger configuration within a context

warning

Python
warning(*args: Any, header: Optional[str] = None, log_opts: Optional[Union[LogOptions, dict]] = None, **kwargs) -> None

Log a WARNING-level message