diff options
author | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-07-14 11:07:37 +0000 |
---|---|---|
committer | shnavid <shnavid@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2007-07-14 11:07:37 +0000 |
commit | f78567b537bd40f6112e051f7206ad36cc5d9828 (patch) | |
tree | 909cf78536dd1cf402737ca5328c619eb75e9322 /src/lib | |
parent | 1596f54d8ad39160f995798f457c759c67c79494 (diff) | |
download | sos-f78567b537bd40f6112e051f7206ad36cc5d9828.tar.gz |
* initial language localization support
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@204 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/sos/plugintools.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/src/lib/sos/plugintools.py b/src/lib/sos/plugintools.py index 1dac3987..930a4d17 100644 --- a/src/lib/sos/plugintools.py +++ b/src/lib/sos/plugintools.py @@ -60,6 +60,8 @@ class PluginBase: self.thread = None self.eta_weight = 1 + self.soslog = logging.getLogger('sos') + # get the option list into a dictionary for opt in self.optionList: self.optNames.append(opt[0]) @@ -87,7 +89,7 @@ class PluginBase: except KeyboardInterrupt: raise KeyboardInterrupt except Exception, e: - self.cInfo['soslog'].log(logging.VERBOSE, "Problem at path %s (%s)\n" % (abspath,e)) + self.soslog.log(logging.VERBOSE, "Problem at path %s (%s)\n" % (abspath,e)) break return False @@ -143,7 +145,7 @@ class PluginBase: except KeyboardInterrupt: raise KeyboardInterrupt except Exception, e: - self.cInfo['soslog'].log(logging.VERBOSE, "Problem at path %s (%s)" % (srcpath+'/'+afile, e)) + self.soslog.log(logging.VERBOSE, "Problem at path %s (%s)" % (srcpath+'/'+afile, e)) # if on forbidden list, abspath is null if not abspath == '': dstslname = sosRelPath(self.cInfo['rptdir'], abspath) @@ -158,13 +160,13 @@ class PluginBase: except KeyboardInterrupt: raise KeyboardInterrupt except Exception, e: - self.cInfo['soslog'].log(logging.VERBOSE, "Problem at path %s (%s)" % (srcpath, e)) + self.soslog.log(logging.VERBOSE, "Problem at path %s (%s)" % (srcpath, e)) return abspath else: if not os.path.exists(srcpath): - self.cInfo['soslog'].debug("File or directory %s does not exist\n" % srcpath) + self.soslog.debug("File or directory %s does not exist\n" % srcpath) elif os.path.isdir(srcpath): for afile in os.listdir(srcpath): if afile == '.' or afile == '..': @@ -185,7 +187,7 @@ class PluginBase: # pylint: disable-msg = W0612 status, shout, runtime = sosGetCommandOutput("/bin/cp --parents -P --preserve=mode,ownership,timestamps,links " + src +" " + self.cInfo['dstroot']) if status: - self.cInfo['soslog'].debug(shout) + self.soslog.debug(shout) abspath = os.path.join(self.cInfo['dstroot'], src.lstrip(os.path.sep)) relpath = sosRelPath(self.cInfo['rptdir'], abspath) return relpath, abspath @@ -194,7 +196,7 @@ class PluginBase: except KeyboardInterrupt: raise KeyboardInterrupt except Exception,e: - self.cInfo['soslog'].warning("Problem copying file %s (%s)" % (src, e)) + self.soslog.warning("Problem copying file %s (%s)" % (src, e)) def addForbiddenPath(self, forbiddenPath): """Specify a path to not copy, even if it's part of a copyPaths[] entry. @@ -273,7 +275,7 @@ class PluginBase: """ # Log if binary is not runnable or does not exist if not os.access(prog.split()[0], os.X_OK): - self.cInfo['soslog'].log(logging.VERBOSE, "binary '%s' does not exist or is not runnable" % prog.split()[0]) + self.soslog.log(logging.VERBOSE, "binary '%s' does not exist or is not runnable" % prog.split()[0]) # pylint: disable-msg = W0612 status, shout, runtime = sosGetCommandOutput(prog) @@ -318,7 +320,7 @@ class PluginBase: """ # First check to make sure the binary exists and is runnable. if not os.access(exe.split()[0], os.X_OK): - self.cInfo['soslog'].log(logging.VERBOSE2, "Binary '%s' does not exist or is not runnable" % exe.split()[0]) + self.soslog.log(logging.VERBOSE2, "Binary '%s' does not exist or is not runnable" % exe.split()[0]) return # pylint: disable-msg = W0612 @@ -402,7 +404,7 @@ class PluginBase: Collect the data for a plugin """ for path in self.copyPaths: - self.cInfo['soslog'].debug("copying pathspec %s" % path) + self.soslog.debug("copying pathspec %s" % path) try: self.doCopyFileOrDir(path) except SystemExit: @@ -410,9 +412,9 @@ class PluginBase: except KeyboardInterrupt: raise KeyboardInterrupt except Exception, e: - self.cInfo['soslog'].log(logging.VERBOSE, "Error copying from pathspec %s (%s)" % (path,e)) + self.soslog.log(logging.VERBOSE, "Error copying from pathspec %s (%s)" % (path,e)) for (prog,suggest_filename,root_symlink) in self.collectProgs: - self.cInfo['soslog'].debug("collecting output of '%s'" % prog) + self.soslog.debug("collecting output of '%s'" % prog) try: self.collectOutputNow(prog, suggest_filename, root_symlink) except SystemExit: @@ -420,7 +422,7 @@ class PluginBase: except KeyboardInterrupt: raise KeyboardInterrupt except: - self.cInfo['soslog'].log(logging.VERBOSE, "Error collecting output of '%s'" % prog,) + self.soslog.log(logging.VERBOSE, "Error collecting output of '%s'" % prog,) def get_description(self): """ This function will return the description for the plugin""" |