Shorten logging output to time

I am not sure we ever need the millisecond output. The date is typically
also clear from the output (we could print the date at the beginning,
once, instead, but this is not done here. Finally, in Jenkins, we
typically get time stamps. Thus, it's not necessary to print this by
default.

On the other hand, since it might be useful when running locally, make
time stamps in logs configurable.
This commit is contained in:
Robert Schmidt
2026-02-18 18:12:00 +01:00
parent e1b7e91f8a
commit 3a9fdb674a
3 changed files with 14 additions and 12 deletions

View File

@@ -44,6 +44,7 @@ import constants as CONST
def ArgsParse(argvs,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER):
force_local = False
date_fmt = None
while len(argvs) > 1:
myArgv = argvs.pop(1) # 0th is this file's name
@@ -56,6 +57,9 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER):
#consider inline parameters
elif re.match(r'^\-\-datefmt=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match(r'^\-\-datefmt=(.+)$', myArgv, re.IGNORECASE)
date_fmt = matchReg.group(1)
elif re.match(r'^\-\-mode=(.+)$', myArgv, re.IGNORECASE):
matchReg = re.match(r'^\-\-mode=(.+)$', myArgv, re.IGNORECASE)
mode = matchReg.group(1)
@@ -168,4 +172,4 @@ def ArgsParse(argvs,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER):
HELP.GenericHelp(CONST.Version)
sys.exit('Invalid Parameter: ' + myArgv)
return mode, force_local
return mode, force_local, date_fmt

View File

@@ -62,13 +62,6 @@ import lxml.etree as ET
import logging
import signal
import traceback
logging.basicConfig(
level=logging.DEBUG,
stream=sys.stdout,
format="[%(asctime)s] %(levelname)8s: %(message)s"
)
#-----------------------------------------------------------
@@ -349,7 +342,12 @@ CLUSTER = cls_cluster.Cluster()
import args_parse
# Force local execution, move all execution targets to localhost
force_local = False
mode, force_local = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER)
mode, force_local, date_fmt = args_parse.ArgsParse(sys.argv,CiTestObj,RAN,HTML,CONTAINERS,HELP,SCA,CLUSTER)
fmt = "%(levelname)8s: %(message)s"
if date_fmt:
fmt = "[%(asctime)s] %(levelname)s %(message)s"
logging.basicConfig(level=logging.DEBUG, stream=sys.stdout, format=fmt, datefmt=date_fmt,)
#-----------------------------------------------------------
# mode amd XML class (action) analysis

View File

@@ -31,15 +31,15 @@ docker tag oai-nr-cuup oai-ci/oai-nr-cuup:develop-${SHORT_COMMIT_SHA}
python3 main.py --mode=InitiateHtml --ranRepository=NONE --ranBranch=${CURRENT_BRANCH} \
--ranCommitID=${COMMIT_SHA} --ranAllowMerge=false \
--ranTargetBranch=NONE \
--XMLTestFile=xml_files/${TESTCASE} --local
--XMLTestFile=xml_files/${TESTCASE} --local --datefmt="%H:%M:%S"
python3 main.py --mode=TesteNB --ranRepository=NONE --ranBranch=${CURRENT_BRANCH} \
--ranCommitID=${COMMIT_SHA} --ranAllowMerge=false \
--ranTargetBranch=NONE \
--eNBSourceCodePath=${REPO_PATH} \
--XMLTestFile=${TESTCASE} --local
--XMLTestFile=${TESTCASE} --local --datefmt="%H:%M:%S"
RET=$?
python3 main.py --mode=FinalizeHtml --local
python3 main.py --mode=FinalizeHtml --local --datefmt="%H:%M:%S"
exit ${RET}