Log Annotation

Client for the log-annotation service.

This allows client code to add operator comments and text-messages to the robot’s log files.

exception bosdyn.client.log_annotation.InvalidArgument[source]

Bases: bosdyn.client.exceptions.Error

A given argument could not be used.

class bosdyn.client.log_annotation.LogAnnotationClient[source]

Bases: bosdyn.client.common.BaseClient

A client for adding annotations to robot logs.

default_service_name = 'log-annotation'
service_type = 'bosdyn.api.LogAnnotationService'

Adopt key objects like processors, logger, and wallet from other.

add_text_messages(text_messages, **kwargs)[source]

Log text messages to the robot.


text_messages – Sequence of LogAnnotationTextMessage protos.


RpcError – Problem communicating with the robot.

add_text_messages_async(text_messages, **kwargs)[source]

Async version of add_text_messages.

add_operator_comment(msg, robot_timestamp=None, **kwargs)[source]

Add an operator comment to the robot log.

  • msg – Text of user comment to log.

  • robot_timestamp – Time (google.protobuf.Timestamp) of messages, in robot time. If not set, timestamp will be when the robot receives the message.


RpcError – Problem communicating with the robot.

add_operator_comment_async(msg, robot_timestamp=None, **kwargs)[source]

Async version of add_operator_comment.

add_log_blob(data, type_id, channel=None, robot_timestamp=None, **kwargs)[source]

Log blob messages to the robot.

  • data – Binary data of one blob.

  • type_id – Type of binary data of blob.

  • robot_timestamp – Time (google.protobuf.Timestamp) of messages, in robot time. If not set, timestamp will be when the robot receives the message.


RpcError – Problem communicating with the robot.

add_log_blob_async(data, type_id, channel=None, robot_timestamp=None, **kwargs)[source]

Async version of add_log_blob.

add_log_protobuf(proto, robot_timestamp=None)[source]
add_log_protobuf_async(proto, robot_timestamp=None)[source]
class bosdyn.client.log_annotation.LogAnnotationHandler(service, log_client, level=0, time_sync_endpoint=None, rpc_timeout=1, msg_num_limit=10, msg_age_limit=1)[source]

Bases: logging.Handler

A logging system Handler that will publish text to a bosdyn.api.LogAnnotationService.

  • service – Name of the service. See LogAnnotationTextMessage.

  • log_client – API client that will send log messages.

  • level – Python logging level. Defaults to NOTSET.

  • time_sync_endpoint – A TimeSyncEndpoint, already synchronized to the remote clock.

  • rpc_timeout – Timeout on RPCs made by log_client.

  • msg_num_limit – If number of messages reaches this number, send data with log_client.

  • msg_age_limit – If messages have been sitting locally for this many seconds, send data with log_client.


InvalidArgument – The TimeSyncEndpoint is not valid.


Do whatever it takes to actually log the specified logging record.

This version is intended to be implemented by subclasses and so raises a NotImplementedError.


Ensure all logging output has been flushed.

This version does nothing and is intended to be implemented by subclasses.


Tidy up any resources used by the handler.

This version removes the handler from an internal map of handlers, _handlers, which is used for handler lookup by name. Subclasses should ensure that this gets called from overridden close() methods.


Restart the send thread.


AssertionError if send thread is still alive.

static record_level_to_proto_level(record_level)[source]