mirror of
https://github.com/akuker/RASCSI.git
synced 2025-02-16 19:31:09 +00:00
Add support for --log-level argument to web UI (#781)
Increase verbosity of web UI log format Add critical to supported log levels for completeness
This commit is contained in:
parent
a09885cdfe
commit
7a18939171
@ -2,6 +2,7 @@
|
||||
Module for the Flask app rendering and endpoints
|
||||
"""
|
||||
|
||||
import sys
|
||||
import logging
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
@ -1028,14 +1029,23 @@ if __name__ == "__main__":
|
||||
default="localhost",
|
||||
action="store",
|
||||
help="RaSCSI host. Default: localhost",
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"--rascsi-port",
|
||||
type=int,
|
||||
default=6868,
|
||||
action="store",
|
||||
help="RaSCSI port. Default: 6868",
|
||||
)
|
||||
)
|
||||
parser.add_argument(
|
||||
"--log-level",
|
||||
type=str,
|
||||
default="warning",
|
||||
action="store",
|
||||
help="Log level for Web UI. Default: warning",
|
||||
choices=["debug", "info", "warning", "error", "critical"],
|
||||
)
|
||||
|
||||
arguments = parser.parse_args()
|
||||
APP.config["TOKEN"] = arguments.password
|
||||
|
||||
@ -1047,5 +1057,9 @@ if __name__ == "__main__":
|
||||
if Path(f"{CFG_DIR}/{DEFAULT_CONFIG}").is_file():
|
||||
file_cmd.read_config(DEFAULT_CONFIG)
|
||||
|
||||
logging.basicConfig(stream=sys.stdout,
|
||||
format="%(asctime)s %(levelname)s %(filename)s:%(lineno)s %(message)s",
|
||||
level=arguments.log_level.upper())
|
||||
|
||||
print("Serving rascsi-web...")
|
||||
bjoern.run(APP, "0.0.0.0", arguments.port)
|
||||
|
@ -102,6 +102,9 @@ while [ "$1" != "" ]; do
|
||||
-o | --rascsi-port)
|
||||
ARG_RASCSI_PORT="--rascsi-port $VALUE"
|
||||
;;
|
||||
-l | --log-level)
|
||||
ARG_LOG_LEVEL="--log-level $VALUE"
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: unknown parameter \"$PARAM\""
|
||||
exit 1
|
||||
@ -114,4 +117,4 @@ PYTHON_COMMON_PATH=$(dirname $PWD)/common/src
|
||||
echo "Starting web server for RaSCSI Web Interface..."
|
||||
export PYTHONPATH=$PWD/src:${PYTHON_COMMON_PATH}
|
||||
cd src
|
||||
python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT}
|
||||
python3 web.py ${ARG_PORT} ${ARG_PASSWORD} ${ARG_RASCSI_HOST} ${ARG_RASCSI_PORT} ${ARG_LOG_LEVEL}
|
||||
|
Loading…
x
Reference in New Issue
Block a user