pyfcstm.entry.simulate.logging

Entry-side logging presentation helpers for simulate CLI.

This module configures the runtime logger (pyfcstm.simulate) with CLI-specific presentation handlers. The entry layer and runtime share the same logger instance to ensure consistent highlighting and formatting.

SimulatePlainLogHandler

class pyfcstm.entry.simulate.logging.SimulatePlainLogHandler(use_color: bool = True)[source]

Plain stderr log handler for simulate CLI.

Parameters:

use_color (bool) – Whether colored terminal output is enabled.

__init__(use_color: bool = True)[source]

Initialize the handler.

If stream is not specified, sys.stderr is used.

SimulateLogHighlighter

class pyfcstm.entry.simulate.logging.SimulateLogHighlighter[source]

Combine Rich repr highlighting with simulate-specific regex highlighting.

__init__()[source]
highlight(text) None[source]

Apply highlighting in place to text.

Args:

text (~Text): A text object highlight.

SimulateRichLogHandler

class pyfcstm.entry.simulate.logging.SimulateRichLogHandler(use_color: bool = True)[source]

Rich-based stderr log handler for simulate CLI.

Parameters:

use_color (bool) – Whether colored terminal output is enabled.

__init__(use_color: bool = True)[source]

Initializes the instance - basically setting the formatter to None and the filter list to empty.

SimulateCliFormatter

class pyfcstm.entry.simulate.logging.SimulateCliFormatter[source]

Formatter for simulate CLI log messages.

The entry layer owns all simulate CLI formatting, using the compact form [%(levelname)s] %(message)s requested by the user.

__init__()[source]

Initialize the formatter with specified format strings.

Initialize the formatter either with the specified format string, or a default as described above. Allow for specialized date formatting with the optional datefmt argument. If datefmt is omitted, you get an ISO8601-like (or RFC 3339-like) format.

Use a style parameter of ‘%’, ‘{’ or ‘$’ to specify that you want to use one of %-formatting, str.format() ({}) formatting or string.Template formatting in your format string.

Changed in version 3.2: Added the style parameter.

create_simulate_log_handler

pyfcstm.entry.simulate.logging.create_simulate_log_handler(use_color: bool = True) Handler[source]

Create a CLI log handler for simulate output.

Uses Rich when colors are enabled. Falls back to a plain standard-library handler otherwise.

Parameters:

use_color (bool) – Whether colored terminal output is enabled.

Returns:

Configured logging handler.

Return type:

logging.Handler

configure_simulate_cli_logger

pyfcstm.entry.simulate.logging.configure_simulate_cli_logger(logger: Logger, use_color: bool = True) None[source]

Configure a runtime logger for CLI presentation.

This function configures the runtime logger (typically pyfcstm.simulate) with CLI-specific handlers and formatting. Both the entry layer and runtime share this logger instance, ensuring consistent highlighting and formatting across all log messages.

This function replaces existing handlers with a single CLI-facing handler so output is not duplicated when multiple command processors are created.

Parameters:
  • logger (logging.Logger) – Runtime logger to configure (typically runtime.logger).

  • use_color (bool) – Whether colored terminal output is enabled.

Returns:

None.

Return type:

None