diff options
author | Andy Grover <andy@groveronline.com> | 2017-09-29 13:13:29 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-29 13:13:29 -0700 |
commit | 5ddd6cac9ef3eaa1cdb7642100d031168dac918a (patch) | |
tree | 70580b0951c41ae849968498f51f93256baa9a59 | |
parent | c7f9600e9a4ffa904fcac738d4f8bbe7935796fb (diff) | |
parent | ab3fa7382a6243692cffaeb67c447a80e7d8f32a (diff) | |
download | configshell-fb-5ddd6cac9ef3eaa1cdb7642100d031168dac918a.tar.gz |
Merge pull request #38 from ryran/run-cmdline-new-verbose-loglevel
make run_cmdline() log "Running command line" msg to new loglevel
-rw-r--r-- | configshell/log.py | 13 | ||||
-rw-r--r-- | 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 01adbc8..96c754a 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) |