Home Assistant Unofficial Reference 2024.12.1
homeassistant.components.system_log Namespace Reference

Classes

class  DedupStore
 
class  LogEntry
 
class  LogErrorHandler
 

Functions

tuple[str, int] _figure_out_source (logging.LogRecord record, re.Pattern[str] paths_re, list[tuple[FrameType, int]]|None extracted_tb=None)
 
str _safe_get_message (logging.LogRecord record)
 
bool async_setup (HomeAssistant hass, ConfigType config)
 
None list_errors (HomeAssistant hass, websocket_api.ActiveConnection connection, dict[str, Any] msg)
 

Variables

string CONF_FIRE_EVENT = "fire_event"
 
string CONF_LEVEL = "level"
 
string CONF_LOGGER = "logger"
 
string CONF_MAX_ENTRIES = "max_entries"
 
string CONF_MESSAGE = "message"
 
 CONFIG_SCHEMA
 
string DATA_SYSTEM_LOG = "system_log"
 
bool DEFAULT_FIRE_EVENT = False
 
int DEFAULT_MAX_ENTRIES = 50
 
string DOMAIN = "system_log"
 
string EVENT_SYSTEM_LOG = "system_log_event"
 
 KeyType
 
string SERVICE_CLEAR = "clear"
 
 SERVICE_CLEAR_SCHEMA = vol.Schema({})
 
string SERVICE_WRITE = "write"
 
 SERVICE_WRITE_SCHEMA
 

Detailed Description

Support for system log.

Function Documentation

◆ _figure_out_source()

tuple[str, int] homeassistant.components.system_log._figure_out_source ( logging.LogRecord  record,
re.Pattern[str]  paths_re,
list[tuple[FrameType, int]] | None   extracted_tb = None 
)
private
Figure out where a log message came from.

Definition at line 66 of file __init__.py.

◆ _safe_get_message()

str homeassistant.components.system_log._safe_get_message ( logging.LogRecord  record)
private
Get message from record and handle exceptions.

This code will be unreachable during a pytest run
because pytest installs a logging handler that
will prevent this code from being reached.

Calling record.getMessage() can raise an exception
if the log message does not contain sufficient arguments.

As there is no guarantees about which exceptions
that can be raised, we catch all exceptions and
return a generic message.

This must be manually tested when changing the code.

Definition at line 137 of file __init__.py.

◆ async_setup()

bool homeassistant.components.system_log.async_setup ( HomeAssistant  hass,
ConfigType  config 
)
Set up the logger component.

Definition at line 295 of file __init__.py.

◆ list_errors()

None homeassistant.components.system_log.list_errors ( HomeAssistant  hass,
websocket_api.ActiveConnection  connection,
dict[str, Any]   msg 
)
List all possible diagnostic handlers.

Definition at line 346 of file __init__.py.

Variable Documentation

◆ CONF_FIRE_EVENT

string homeassistant.components.system_log.CONF_FIRE_EVENT = "fire_event"

Definition at line 25 of file __init__.py.

◆ CONF_LEVEL

string homeassistant.components.system_log.CONF_LEVEL = "level"

Definition at line 27 of file __init__.py.

◆ CONF_LOGGER

string homeassistant.components.system_log.CONF_LOGGER = "logger"

Definition at line 28 of file __init__.py.

◆ CONF_MAX_ENTRIES

string homeassistant.components.system_log.CONF_MAX_ENTRIES = "max_entries"

Definition at line 24 of file __init__.py.

◆ CONF_MESSAGE

string homeassistant.components.system_log.CONF_MESSAGE = "message"

Definition at line 26 of file __init__.py.

◆ CONFIG_SCHEMA

homeassistant.components.system_log.CONFIG_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  DOMAIN: vol.Schema(
4  {
5  vol.Optional(
6  CONF_MAX_ENTRIES, default=DEFAULT_MAX_ENTRIES
7  ): cv.positive_int,
8  vol.Optional(CONF_FIRE_EVENT, default=DEFAULT_FIRE_EVENT): cv.boolean,
9  }
10  )
11  },
12  extra=vol.ALLOW_EXTRA,
13 )

Definition at line 40 of file __init__.py.

◆ DATA_SYSTEM_LOG

string homeassistant.components.system_log.DATA_SYSTEM_LOG = "system_log"

Definition at line 30 of file __init__.py.

◆ DEFAULT_FIRE_EVENT

bool homeassistant.components.system_log.DEFAULT_FIRE_EVENT = False

Definition at line 32 of file __init__.py.

◆ DEFAULT_MAX_ENTRIES

int homeassistant.components.system_log.DEFAULT_MAX_ENTRIES = 50

Definition at line 31 of file __init__.py.

◆ DOMAIN

string homeassistant.components.system_log.DOMAIN = "system_log"

Definition at line 33 of file __init__.py.

◆ EVENT_SYSTEM_LOG

string homeassistant.components.system_log.EVENT_SYSTEM_LOG = "system_log_event"

Definition at line 35 of file __init__.py.

◆ KeyType

homeassistant.components.system_log.KeyType

Definition at line 22 of file __init__.py.

◆ SERVICE_CLEAR

string homeassistant.components.system_log.SERVICE_CLEAR = "clear"

Definition at line 37 of file __init__.py.

◆ SERVICE_CLEAR_SCHEMA

homeassistant.components.system_log.SERVICE_CLEAR_SCHEMA = vol.Schema({})

Definition at line 54 of file __init__.py.

◆ SERVICE_WRITE

string homeassistant.components.system_log.SERVICE_WRITE = "write"

Definition at line 38 of file __init__.py.

◆ SERVICE_WRITE_SCHEMA

homeassistant.components.system_log.SERVICE_WRITE_SCHEMA
Initial value:
1 = vol.Schema(
2  {
3  vol.Required(CONF_MESSAGE): cv.string,
4  vol.Optional(CONF_LEVEL, default="error"): vol.In(
5  ["debug", "info", "warning", "error", "critical"]
6  ),
7  vol.Optional(CONF_LOGGER): cv.string,
8  }
9 )

Definition at line 55 of file __init__.py.