Skip to content

Commit

Permalink
SmurfCommandMixin._caput: Log not print kwargs message.
Browse files Browse the repository at this point in the history
  • Loading branch information
tristpinsm committed Oct 2, 2024
1 parent 8d9b23e commit b383c00
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion python/pysmurf/client/command/smurf_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def _caput(self, pvname, val, atca=False, cast_type=True, **kwargs):
for k,v in kwargs.items():

if v is not None:
print(f"Unexpected kwargs: {k} = {v}")
self.log(f"Unexpected kwargs: {k} = {v}", self.LOG_INFO)
#err=True

if err:
Expand Down
15 changes: 15 additions & 0 deletions python/pysmurf/core/server_scripts/Common.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import subprocess
import sys
import zipfile
import logging

import pyrogue

Expand All @@ -48,6 +49,16 @@ def process_args(args):
if it was not defined.
"""

# Setup logging
logger = logging.getLogger()
logger.setLevel(args.log_level)
# set up a handler with timestamps
handler = logging.StreamHandler()
handler.setLevel(args.log_level)
formatter = logging.Formatter("[%(asctime)s] %(levelname)s:%(name)s: %(msg)s")
handler.setFormatter(formatter)
logger.addHandler(handler)

# Verify if the zip file was specified
if args.zip_file:
zip_file_name = args.zip_file
Expand Down Expand Up @@ -204,5 +215,9 @@ def make_parser(parser=None):
group.add_argument('--use-qt', action='store_true', dest='use_qt',
default=False, help="Use the QT ."
)
group.add_argument('--log-level', type=str.upper, help="Set the logging level.",
choices=["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"],
default="WARNING"
)

return parser

0 comments on commit b383c00

Please sign in to comment.