From ab3fa7382a6243692cffaeb67c447a80e7d8f32a Mon Sep 17 00:00:00 2001 From: Ryan Sawhill Aroha Date: Tue, 26 Sep 2017 17:52:35 -0400 Subject: make run_cmdline() log "Running command line" msg to new loglevel --- configshell/log.py | 13 +++++++++++-- configshell/shell.py | 2 +- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/configshell/log.py b/configshell/log.py index e932aaa..003d862 100644 --- a/configshell/log.py +++ b/configshell/log.py @@ -28,6 +28,7 @@ class Log(object): Implements a file and console logger using python's logging facility. Log levels are, in raising criticality: - debug + - verbose - info - warning - error @@ -36,9 +37,9 @@ class Log(object): who can then be read/changed by other objects using Prefs() ''' __borg_state = {} - levels = ['critical', 'error', 'warning', 'info', 'debug'] + levels = ['critical', 'error', 'warning', 'info', 'verbose', 'debug'] colors = {'critical': 'red', 'error': 'red', 'warning': 'yellow', - 'info': 'green', 'debug': 'blue'} + 'info': 'green', 'verbose': 'blue', 'debug': 'blue'} def __init__(self, console_level=None, logfile=None, file_level=None): @@ -138,6 +139,14 @@ class Log(object): trace += '\n%s' % msg self._log('error', trace) + def verbose(self, msg): + ''' + Logs a verbose message. + @param msg: The message to log. + @type msg: str + ''' + self._log('verbose', msg) + def info(self, msg): ''' Logs an info message. diff --git a/configshell/shell.py b/configshell/shell.py index 3d0fce9..e85cdd6 100644 --- a/configshell/shell.py +++ b/configshell/shell.py @@ -843,7 +843,7 @@ class ConfigShell(object): @type cmdline: str ''' if cmdline: - self.log.debug("Running command line '%s'." % cmdline) + self.log.verbose("Running command line '%s'." % cmdline) path, command, pparams, kparams = self._parse_cmdline(cmdline)[1:] self._execute_command(path, command, pparams, kparams) -- cgit v1.2.1