Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benoit Rousselle
bliss
Commits
815ee247
Commit
815ee247
authored
May 15, 2019
by
Piergiorgio Pancino
Browse files
Delegate logging initialization to bliss subprocess
parent
e29946b1
Changes
2
Hide whitespace changes
Inline
Side-by-side
bliss/shell/cli/main.py
View file @
815ee247
...
...
@@ -6,7 +6,7 @@
# Distributed under the GNU LGPLv3. See LICENSE for more info.
"""
Usage: bliss [-l | --log-level=<log_level>] [-s <name> | --session=<name>] [--no-tmux]
bliss [-v | --version]
bliss [-c <name> | --create=<name>]
...
...
@@ -33,7 +33,6 @@ warnings.filterwarnings("ignore", module="jinja2")
import
os
import
sys
import
logging
import
subprocess
from
docopt
import
docopt
,
DocoptExit
...
...
@@ -172,12 +171,6 @@ def main():
print
(
""
)
arguments
=
docopt
(
__doc__
)
# log level
log_level
=
getattr
(
logging
,
arguments
[
"--log-level"
][
0
].
upper
())
fmt
=
"%(levelname)s %(asctime)-15s %(name)s: %(message)s"
logging
.
basicConfig
(
level
=
log_level
,
format
=
fmt
)
logging
.
getLogger
(
"bliss"
).
setLevel
(
log_level
)
# Print version
if
arguments
[
"--version"
]:
print
((
"BLISS version %s"
%
release
.
short_version
))
...
...
@@ -276,6 +269,7 @@ def main():
"-m"
,
"bliss.shell.cli.start_bliss_repl"
,
session
,
arguments
[
"--log-level"
][
0
],
]
)
ans
=
subprocess
.
run
(
...
...
bliss/shell/cli/start_bliss_repl.py
View file @
815ee247
...
...
@@ -8,10 +8,20 @@
import
sys
from
bliss.shell.cli.repl
import
embed
import
logging
fmt
=
"%(levelname)s %(asctime)-15s %(name)s: %(message)s"
def
main
():
session_name
=
sys
.
argv
[
1
]
log_level
=
getattr
(
logging
,
sys
.
argv
[
2
].
upper
())
# activate logging for module-level and session-level loggers
logging
.
basicConfig
(
format
=
fmt
)
logging
.
getLogger
(
"bliss"
).
setLevel
(
log_level
)
logging
.
getLogger
(
"beamline"
).
setLevel
(
log_level
)
embed
(
session_name
=
session_name
,
use_tmux
=
True
)
...
...
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