Skip to content

Commit 7a3c321

Browse files
committed
qtvcp: change default logging level
Changed default logging level to WARNING to quiet the terminal. Added -i option to turn on info logging if necessary.
1 parent 7fe861d commit 7a3c321

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

docs/src/gui/qtvcp.adoc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,17 +73,20 @@ Under the [DISPLAY] heading:
7373
----
7474
DISPLAY = qtvcp <options> <screen_name>
7575
options:
76-
-d debugging on
7776
-a set window always on top
7877
-c HAL component name. Default is to use the UI file name.
78+
-d debugging on
79+
-f fullscreen the window
7980
-g geometry: WIDTHxHEIGHT+XOFFSET+YOFFSET example: -g 200x400+0+100
81+
-H execute HAL statements from FILE with halcmd after the component is set up and ready
82+
-i set logging level to INFO
8083
-m maximize window
81-
-f fullscreen the window
84+
-o pass a string to qtvcp's handler file under self.w.USEROPTIONS_ list variable. can be multiple -o
8285
-t theme. Default is system theme
86+
-u file path of a substitute handler file
87+
-v enable VERBOSE debug output
8388
-x embed into a X11 window that doesn't support embedding.
8489
--push_xid send qtvcp's X11 window id number to standard output; for embedding
85-
-u file path of a substitute handler file
86-
-o pass a string to qtvcp's handler file under self.w.USEROPTIONS_ list variable. can be multiple -o
8790
8891
all <options> must be before <screen name>
8992
<screen_name> is the base name of the .ui and _handler.py files.

lib/python/qtvcp/logger.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ def verbose(self, message, *args, **kws):
4545

4646
# Global name of the base logger
4747
BASE_LOGGER_NAME = None
48+
BASE_LOGGER_FILE = None
4849

4950
# Define the log message formats
5051
TERM_FORMAT = '[%(name)s][%(levelname)s] %(message)s (%(filename)s:%(lineno)d)'
@@ -63,6 +64,7 @@ def getLogger(name):
6364
def setGlobalLevel(level):
6465
base_log = logging.getLogger(BASE_LOGGER_NAME)
6566
base_log.setLevel(level)
67+
base_log.info('Logging to: yellow<{}>'.format(BASE_LOGGER_FILE))
6668
base_log.info('Base log level set to: yellow<{}>'.format(level))
6769

6870

@@ -75,6 +77,9 @@ def initBaseLogger(name, log_file=None, log_level=DEBUG):
7577
if not log_file:
7678
log_file = getLogFile(name)
7779

80+
global BASE_LOGGER_FILE
81+
BASE_LOGGER_FILE = log_file
82+
7883
# Clear the previous sessions log file
7984
with open(log_file, 'w') as fh:
8085
pass

src/emc/usr_intf/qtvcp/qtvcp.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# We have do do this before importing other modules because on import
1616
# they set up their own loggers as children of the base logger.
1717
from qtvcp import logger
18-
LOG = logger.initBaseLogger('QTvcp', log_file=None, log_level=logger.INFO)
18+
LOG = logger.initBaseLogger('QTvcp', log_file=None, log_level=logger.WARNING)
1919

2020

2121
from qtvcp.core import Status, Info, Qhal, Path
@@ -53,6 +53,8 @@
5353
use -g WIDTHxHEIGHT for just setting size or -g +XOFFSET+YOFFSET for just position.""")
5454
, Option( '-H', dest='halfile', metavar='FILE'
5555
, help="execute HAL statements from FILE with halcmd after the component is set up and ready")
56+
, Option( '-i', action='store_true', dest='info', default=False
57+
, help="Enable info output")
5658
, Option( '-m', action='store_true', dest='maximum', help="Force panel window to maximize")
5759
, Option( '-f', action='store_true', dest='fullscreen', help="Force panel window to fullscreen")
5860
, Option( '-t', dest='theme', default="", help="Set QT style. Default is system theme")
@@ -138,6 +140,9 @@ def __init__(self):
138140
# Log level defaults to INFO, so set lowest if in verbose mode
139141
logger.setGlobalLevel(logger.VERBOSE)
140142
LOG.verbose('VERBOSE DEBUGGING ON')
143+
if opts.info:
144+
logger.setGlobalLevel(logger.INFO)
145+
141146

142147
# a specific path has been set to load from or...
143148
# no path set but -ini is present: default qtvcp screen...or

0 commit comments

Comments
 (0)