Commit 815ee247 authored by Piergiorgio Pancino's avatar Piergiorgio Pancino

Delegate logging initialization to bliss subprocess

parent e29946b1
......@@ -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(
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment