Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Łukasz Nowak
slapos.toolbox
Commits
fe05d650
Commit
fe05d650
authored
Oct 03, 2012
by
Alain Takoudjou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Set log option as used in slaprunner recipe
parent
f262c408
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
slapos/runner/__init__.py
slapos/runner/__init__.py
+6
-6
No files found.
slapos/runner/__init__.py
View file @
fe05d650
...
...
@@ -17,7 +17,7 @@ class Parser(OptionParser):
"""
OptionParser
.
__init__
(
self
,
usage
=
usage
,
version
=
version
,
option_list
=
[
Option
(
"-l"
,
"--log
_
file"
,
Option
(
"-l"
,
"--logfile"
,
help
=
"The path to the log file used by the script."
,
type
=
str
),
Option
(
"-v"
,
"--verbose"
,
...
...
@@ -72,17 +72,17 @@ class Config:
if
self
.
console
:
self
.
logger
.
addHandler
(
logging
.
StreamHandler
())
if
self
.
log
_
file
:
if
not
os
.
path
.
isdir
(
os
.
path
.
dirname
(
self
.
log
_
file
)):
if
self
.
logfile
:
if
not
os
.
path
.
isdir
(
os
.
path
.
dirname
(
self
.
logfile
)):
# fallback to console only if directory for logs does not exists and
# continue to run
raise
ValueError
(
'Please create directory %r to store %r log file'
%
(
os
.
path
.
dirname
(
self
.
log
_file
),
self
.
log_
file
))
os
.
path
.
dirname
(
self
.
log
file
),
self
.
log
file
))
else
:
file_handler
=
logging
.
FileHandler
(
self
.
log
_
file
)
file_handler
=
logging
.
FileHandler
(
self
.
logfile
)
file_handler
.
setFormatter
(
logging
.
Formatter
(
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
))
self
.
logger
.
addHandler
(
file_handler
)
self
.
logger
.
info
(
'Configured logging to file %r'
%
self
.
log
_
file
)
self
.
logger
.
info
(
'Configured logging to file %r'
%
self
.
logfile
)
self
.
logger
.
info
(
"Started."
)
self
.
logger
.
info
(
os
.
environ
[
'PATH'
])
...
...
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