mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Fix typos (#11781)
This commit is contained in:
parent
7fe2dafa04
commit
b1fd9daf5f
@ -1,36 +1,35 @@
|
||||
"""
|
||||
Support for system log.
|
||||
|
||||
For more details about this platform, please refer to the documentation at
|
||||
For more details about this component, please refer to the documentation at
|
||||
https://home-assistant.io/components/system_log/
|
||||
"""
|
||||
import re
|
||||
import asyncio
|
||||
import logging
|
||||
import traceback
|
||||
from io import StringIO
|
||||
from collections import deque
|
||||
from io import StringIO
|
||||
import logging
|
||||
import re
|
||||
import traceback
|
||||
|
||||
import voluptuous as vol
|
||||
|
||||
from homeassistant import __path__ as HOMEASSISTANT_PATH
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
from homeassistant.components.http import HomeAssistantView
|
||||
|
||||
DOMAIN = 'system_log'
|
||||
DEPENDENCIES = ['http']
|
||||
SERVICE_CLEAR = 'clear'
|
||||
import homeassistant.helpers.config_validation as cv
|
||||
|
||||
CONF_MAX_ENTRIES = 'max_entries'
|
||||
|
||||
DEFAULT_MAX_ENTRIES = 50
|
||||
|
||||
DATA_SYSTEM_LOG = 'system_log'
|
||||
DEFAULT_MAX_ENTRIES = 50
|
||||
DEPENDENCIES = ['http']
|
||||
DOMAIN = 'system_log'
|
||||
|
||||
SERVICE_CLEAR = 'clear'
|
||||
|
||||
CONFIG_SCHEMA = vol.Schema({
|
||||
DOMAIN: vol.Schema({
|
||||
vol.Optional(CONF_MAX_ENTRIES,
|
||||
default=DEFAULT_MAX_ENTRIES): cv.positive_int,
|
||||
vol.Optional(CONF_MAX_ENTRIES, default=DEFAULT_MAX_ENTRIES):
|
||||
cv.positive_int,
|
||||
}),
|
||||
}, extra=vol.ALLOW_EXTRA)
|
||||
|
||||
@ -48,9 +47,9 @@ class LogErrorHandler(logging.Handler):
|
||||
def emit(self, record):
|
||||
"""Save error and warning logs.
|
||||
|
||||
Everyhing logged with error or warning is saved in local buffer. A
|
||||
Everything logged with error or warning is saved in local buffer. A
|
||||
default upper limit is set to 50 (older entries are discarded) but can
|
||||
be changed if neeeded.
|
||||
be changed if needed.
|
||||
"""
|
||||
if record.levelno >= logging.WARN:
|
||||
stack = []
|
||||
@ -97,7 +96,7 @@ def _figure_out_source(record, call_stack, hass):
|
||||
paths.append(netdisco_path[0])
|
||||
except ImportError:
|
||||
pass
|
||||
# If a stack trace exists, extract filenames from the entire call stack.
|
||||
# If a stack trace exists, extract file names from the entire call stack.
|
||||
# The other case is when a regular "log" is made (without an attached
|
||||
# exception). In that case, just use the file where the log was made from.
|
||||
if record.exc_info:
|
||||
@ -115,10 +114,10 @@ def _figure_out_source(record, call_stack, hass):
|
||||
stack = call_stack[0:index+1]
|
||||
|
||||
# Iterate through the stack call (in reverse) and find the last call from
|
||||
# a file in HA. Try to figure out where error happened.
|
||||
# a file in Home Assistant. Try to figure out where error happened.
|
||||
for pathname in reversed(stack):
|
||||
|
||||
# Try to match with a file within HA
|
||||
# Try to match with a file within Home Assistant
|
||||
match = re.match(r'(?:{})/(.*)'.format('|'.join(paths)), pathname)
|
||||
if match:
|
||||
return match.group(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user