libmuscle.logging module

class libmuscle.logging.LogLevel(value)[source]

Bases: Enum

Log levels for MUSCLE 3.

These match the levels in the MUSCLE Manager Protocol, and should be kept identical to those. They also match the Python logging log levels, although not numerically.

CRITICAL = 5
DEBUG = 0
ERROR = 4
INFO = 1
WARNING = 3
as_python_level() int[source]

Convert the LogLevel to the corresponding Python level.

static from_grpc(level: <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f1836109780>) LogLevel[source]

Creates a log level from a gRPC-generated LogLevel message.

Parameters

level – A log level, received from gRPC.

Returns

The same log level, as a LogLevel.

static from_python_level(level: int) LogLevel[source]

Creates a LogLevel from a Python log level.

Parameters

level – A standard Python log level, such as logging.WARNING.

Returns

The same level, but as a LogLevel.

to_grpc() <google.protobuf.internal.enum_type_wrapper.EnumTypeWrapper object at 0x7f1836109780>[source]

Converts the log level to the gRPC generated type.

Parameters

level – A log level.

Returns

The same log level, as the gRPC type.

class libmuscle.logging.LogMessage(instance_id: str, timestamp: Timestamp, level: LogLevel, text: str)[source]

Bases: object

A log message as used by MUSCLE 3.

Parameters
  • instance_id – The identifier of the instance that generated this message.

  • timestamp – When the message was generated (real-world, not simulation).

  • level – Log level of the message.

  • text – Content of the message.

instance_id

The identifier of the instance that generated this message.

timestamp

When the message was generated (real-world, not simulation).

level

Log level of the message.

text

Content of the message.

to_grpc() LogMessage[source]

Converts the log message to the gRPC-generated type.

Parameters

message – A log message.

Returns

The same log message, as the gRPC type.