Emitter Module API Reference¶
This section documents the internals of the emitter
module in Bijux CLI.
bijux_cli.contracts.emitter ¶
Defines the contract for the structured output emission service.
This module specifies the EmitterProtocol
, a formal interface that any service responsible for serializing data payloads (e.g., to JSON or YAML) and emitting them to an output stream must implement.
EmitterProtocol ¶
Bases: Protocol
Defines the contract for emitting structured output.
This interface specifies the methods for serializing and emitting data in various formats, often integrating with a logging or telemetry system.
emit ¶
emit(
payload: Any,
*,
fmt: OutputFormat | None = None,
pretty: bool = False,
level: str = "info",
message: str = "Emitting output",
output: str | None = None,
**context: Any,
) -> None
Serializes and emits a structured data payload.
Parameters:
-
payload
(Any
) –The data payload to serialize and emit.
-
fmt
(OutputFormat | None
, default:None
) –The output format for serialization.
-
pretty
(bool
, default:False
) –If True, pretty-prints the output with indentation.
-
level
(str
, default:'info'
) –The log level for any accompanying message.
-
message
(str
, default:'Emitting output'
) –A descriptive message for logging.
-
output
(str | None
, default:None
) –An optional pre-formatted string to emit instead of serializing the payload.
-
**context
(Any
, default:{}
) –Additional key-value pairs for structured logging.
Returns:
-
None
(None
) –