log
Classes
|
Handles logging of events, errors, alarms, and other system info. |
- class Log[source]
Bases:
objectHandles logging of events, errors, alarms, and other system info.
- event
Handler for generic events.
- Type:
- temp
Handler for temperature events.
- Type:
- cam
Handler for camera overlay text.
- Type:
- telegram_bot
Handler for Telegram notifications.
- Type:
- info(description: str, subject: str = 'system') None[source]
Logs an informational message.
- Parameters:
description (str) – The message content.
subject (str) – The subject related to the info.
- temperature(temperature: float, humidity: float) None[source]
Logs temperature and humidity data.
- Parameters:
temperature (float) – The temperature value.
humidity (float) – The humidity value.
- start(task: str, subject: str = 'system') None[source]
Logs the start of a task.
- Parameters:
task (str) – The task name.
subject (str) – The subject involved.
- end(task: str, subject: str = 'system') None[source]
Logs the end of a task.
- Parameters:
task (str) – The task name.
subject (str) – The subject involved.
- error(description: str, subject: str = 'system', exception: str | None = None) None[source]
Logs an error message.
- Parameters:
description (str) – The error description.
subject (str) – The subject involved.
exception (str | None) – Optional exception traceback string.
- alarm(description: str, subject: str = 'system', exception: str | None = None, report: bool = False) None[source]
Logs an alarm and sends a Telegram notification.
- Parameters:
description (str) – The alarm description.
subject (str) – The subject involved.
exception (str | None) – Optional exception traceback string.
report (bool) – If True, skips logging to event log (used for reports).
- clean_text(exception: str | None, description: str) str[source]
Formats an exception traceback into a single line string.
- Parameters:
exception (str | None) – The exception traceback.
description (str) – The initial description.
- Returns:
The cleaned and formatted string.
- Return type:
str