Fix logger bug on Windows: path contains '\'. (#12197)

* Fix logger bug on Windows: path contains '\'.

* update

* Update __init__.py
This commit is contained in:
Boyi C authored and Paulus Schoutsen committed 2018-02-06 12:56:31 -08:00
1 parent bd29cd2ba2
commit 7e246e4680
1 file changed
+2 -1
@@ -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
# 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):
# 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:
return match.group(1)
# Ok, we don't know what this is