Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
poezio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Pierre-Samuel Le Stang
poezio
Commits
c1bc46cb
Commit
c1bc46cb
authored
Jul 19, 2018
by
Link Mauve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
config: Try to create the logs directory before setting up error logs.
parent
31ec0564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
8 deletions
+14
-8
poezio/config.py
poezio/config.py
+14
-8
No files found.
poezio/config.py
View file @
c1bc46cb
...
...
@@ -594,14 +594,20 @@ def setup_logging():
LOG_DIR
=
config
.
get
(
'log_dir'
)
LOG_DIR
=
Path
(
LOG_DIR
).
expanduser
()
if
LOG_DIR
else
xdg
.
DATA_HOME
/
'logs'
if
config
.
get
(
'log_errors'
):
LOGGING_CONFIG
[
'root'
][
'handlers'
].
append
(
'error'
)
LOGGING_CONFIG
[
'handlers'
][
'error'
]
=
{
'level'
:
'ERROR'
,
'class'
:
'logging.FileHandler'
,
'filename'
:
str
(
LOG_DIR
/
'errors.log'
),
'formatter'
:
'simple'
,
}
logging
.
disable
(
logging
.
WARNING
)
try
:
LOG_DIR
.
mkdir
(
parents
=
True
,
exist_ok
=
True
)
except
OSError
:
# We can’t really log any error here, because logging isn’t setup yet.
pass
else
:
LOGGING_CONFIG
[
'root'
][
'handlers'
].
append
(
'error'
)
LOGGING_CONFIG
[
'handlers'
][
'error'
]
=
{
'level'
:
'ERROR'
,
'class'
:
'logging.FileHandler'
,
'filename'
:
str
(
LOG_DIR
/
'errors.log'
),
'formatter'
:
'simple'
,
}
logging
.
disable
(
logging
.
WARNING
)
if
options
.
debug
:
LOGGING_CONFIG
[
'root'
][
'handlers'
].
append
(
'debug'
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment