Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
HomeAssistant
Core
Commits
3a0a8da6
Unverified
Commit
3a0a8da6
authored
3 years ago
by
jan iversen
Committed by
GitHub
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Change logging to do rollover() instead of rotate() (#55177)
* Change to rollover from rotate. * Remove test log files.
parent
d984e137
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitignore
+1
-1
1 addition, 1 deletion
.gitignore
homeassistant/bootstrap.py
+2
-2
2 additions, 2 deletions
homeassistant/bootstrap.py
tests/test_bootstrap.py
+5
-0
5 additions, 0 deletions
tests/test_bootstrap.py
with
8 additions
and
3 deletions
.gitignore
+
1
−
1
View file @
3a0a8da6
...
...
@@ -2,7 +2,7 @@ config/*
config2/*
tests/testing_config/deps
tests/testing_config/home-assistant.log
tests/testing_config/home-assistant.log
*
# hass-release
data/
...
...
This diff is collapsed.
Click to expand it.
homeassistant/bootstrap.py
+
2
−
2
View file @
3a0a8da6
...
...
@@ -332,7 +332,7 @@ def async_enable_logging(
not
err_path_exists
and
os
.
access
(
err_dir
,
os
.
W_OK
)
):
err_handler
:
logging
.
FileHandler
err_handler
:
logging
.
handlers
.
RotatingFileHandler
|
logging
.
handlers
.
TimedRotating
FileHandler
if
log_rotate_days
:
err_handler
=
logging
.
handlers
.
TimedRotatingFileHandler
(
err_log_path
,
when
=
"
midnight
"
,
backupCount
=
log_rotate_days
...
...
@@ -342,7 +342,7 @@ def async_enable_logging(
err_log_path
,
backupCount
=
1
)
err_handler
.
rotate
(
err_log_path
,
f
"
{
err_log_path
[
:
-
4
]
}
.previous.log
"
)
err_handler
.
doRollover
(
)
err_handler
.
setLevel
(
logging
.
INFO
if
verbose
else
logging
.
WARNING
)
err_handler
.
setFormatter
(
logging
.
Formatter
(
fmt
,
datefmt
=
datefmt
))
...
...
This diff is collapsed.
Click to expand it.
tests/test_bootstrap.py
+
5
−
0
View file @
3a0a8da6
"""
Test the bootstrapping.
"""
# pylint: disable=protected-access
import
asyncio
import
glob
import
os
from
unittest.mock
import
Mock
,
patch
...
...
@@ -69,6 +70,10 @@ async def test_async_enable_logging(hass):
log_file
=
"
test.log
"
,
)
mock_async_activate_log_queue_handler
.
assert_called_once
()
for
f
in
glob
.
glob
(
"
test.log*
"
):
os
.
remove
(
f
)
for
f
in
glob
.
glob
(
"
testing_config/home-assistant.log*
"
):
os
.
remove
(
f
)
async
def
test_load_hassio
(
hass
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment