lox.loggers.Logger#

class lox.loggers.Logger#

Bases: Generic[LoggerStateT], ABC

Undoc-members:

__init__()#

Methods

abstract callback(logger_state, logs)#
abstract init(*args, **kwargs)#
Return type:

TypeVar(LoggerStateT, bound= LoggerState)

log(logger_state, logs)#
Return type:

TypeVar(LoggerStateT, bound= LoggerState)

spool(f, logger_state, keep_logs=False, interval=None, reduce=None, prefix='')#

Wraps a function to log its output.

Parameters:
  • f (Callable) – The function to be wrapped.

  • logger_state (TypeVar(LoggerStateT, bound= LoggerState)) – The state of the logger.

  • keep_logs (bool) – Whether to keep all logs or just the reduced value.

  • interval (int | None) – The interval at which to log.

  • reduce (str | None) – The reduction method to apply to the logs.

  • prefix (str) – An optional prefix to add to the log keys.

Return type:

Callable[..., tuple[Any, TypeVar(LoggerStateT, bound= LoggerState)]]

Returns:

A wrapped function that logs its output.

tap(f, logger_state, argnames=None, prefix='')#
Return type:

Callable[..., TypeVar(LoggerStateT, bound= LoggerState)]