libmuscle.manager.logger module
- class libmuscle.manager.logger.Formatter(fmt=None, datefmt=None, style='%', validate=True, *, defaults=None)[source]
Bases:
FormatterA custom formatter that can format remote messages.
- class libmuscle.manager.logger.Logger(log_dir: Path | None = None, log_level: str | None = None)[source]
Bases:
objectThe MUSCLE3 Manager Logger component.
The Logger component configures the local logging system to output to the central log file, and it accepts messages from remote instances to write to it as well. Log levels are also set here.
- log_message(instance_id: str, timestamp: Timestamp, level: LogLevel, text: str) None[source]
Log a message.
- Parameters:
instance_id – Identifier of the instance that generated the message.
timestamp – Time when this log message was generated, according to the clock on that machine.
level – The log level of the message.
text – The message text.
- libmuscle.manager.logger.last_lines(file: Path, count: int) str[source]
Utility function that returns the last lines of a text file.
This opens the file and returns the final count lines. It reads at most 10000 bytes, to avoid memory problems if the file contains e.g. a large amount of binary data.
- Parameters:
file – The file to read
count – Number of lines to read
- Returns:
A string of at most 10000 bytes, containing at most count newlines.