mirror of
https://github.com/home-assistant/core.git
synced 2025-06-27 00:17:10 +00:00
Fix logger bug on Windows: path contains '\'. (#12197)
* Fix logger bug on Windows: path contains '\'. * update * Update __init__.py
This commit is contained in:
parent
bd29cd2ba2
commit
7e246e4680
@ -76,10 +76,11 @@ def _figure_out_source(record, call_stack, hass):
|
|||||||
|
|
||||||
# Iterate through the stack call (in reverse) and find the last call from
|
# Iterate through the stack call (in reverse) and find the last call from
|
||||||
# a file in Home Assistant. Try to figure out where error happened.
|
# a file in Home Assistant. Try to figure out where error happened.
|
||||||
|
paths_re = r'(?:{})/(.*)'.format('|'.join([re.escape(x) for x in paths]))
|
||||||
for pathname in reversed(stack):
|
for pathname in reversed(stack):
|
||||||
|
|
||||||
# Try to match with a file within Home Assistant
|
# Try to match with a file within Home Assistant
|
||||||
match = re.match(r'(?:{})/(.*)'.format('|'.join(paths)), pathname)
|
match = re.match(paths_re, pathname)
|
||||||
if match:
|
if match:
|
||||||
return match.group(1)
|
return match.group(1)
|
||||||
# Ok, we don't know what this is
|
# Ok, we don't know what this is
|
||||||
|
Loading…
x
Reference in New Issue
Block a user