stream_service_logs#

MonitorApi.stream_service_logs(client_type, *, backlog=100, max_messages=None)#

Stream log messages for a named HPS service.

Subscribes to messages filtered by the client_type tag and yields each message as it arrives. Use ClientType constants for well-known services.

Return type:

Generator[MonitorMessage, None, None]

Parameters:
client_typestr

The client_type tag value to filter on. Use a ClientType constant, e.g. ClientType.JMS, ClientType.HOUSEKEEPER, or ClientType.SCALING.

backlogint, optional

Number of historical messages to request on connect. The default is 100.

max_messagesint or None, optional

Maximum total messages to yield before closing the connection. The default is None, which streams indefinitely until interrupted or the server closes the connection.

Yields:
MonitorMessage

Parsed JSON message dicts from the server.

Examples

>>> for msg in api.stream_service_logs(ClientType.JMS):
...     print(msg)