diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-11-20 15:41:46 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-11-20 15:41:46 +0000 |
commit | 4c72dd74ad64c52fb1424416fe35f6235514e66d (patch) | |
tree | f8e280c86496ad138e3f2858143eb5ef67e5c65d /src/lib | |
parent | 0f07fb09115d71990bcf3844782ce4174f2158ff (diff) | |
download | bcfg2-4c72dd74ad64c52fb1424416fe35f6235514e66d.tar.gz bcfg2-4c72dd74ad64c52fb1424416fe35f6235514e66d.tar.bz2 bcfg2-4c72dd74ad64c52fb1424416fe35f6235514e66d.zip |
Plugin: add a per-plugin runtime debugging infrastructure
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5585 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/Server/Plugin.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lib/Server/Plugin.py b/src/lib/Server/Plugin.py index 51156a567..73c25c627 100644 --- a/src/lib/Server/Plugin.py +++ b/src/lib/Server/Plugin.py @@ -53,7 +53,7 @@ class Plugin(object): name = 'Plugin' __version__ = '$Id$' __author__ = 'bcfg-dev@mcs.anl.gov' - __rmi__ = [] + __rmi__ = ['toggle_debug'] experimental = False deprecated = False @@ -64,6 +64,14 @@ class Plugin(object): self.data = "%s/%s" % (datastore, self.name) self.logger = logging.getLogger('Bcfg2.Plugins.%s' % (self.name)) self.running = True + self.debug_flag = False + + def toggle_debug(self): + self.debug_flag = not self.debug_flag + + def debug_log(self, message, flag=None): + if (flag is None) and self.debug_flag or flag: + self.logger.error(message) @staticmethod def make_path(path): |