From 073d7c6806b3a2e7e133dd37ea7633ccc47112b6 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Mon, 5 Oct 2015 14:17:33 -0400 Subject: [PATCH] Add some verbose message for validate / update commands When you run grafana-dashboards, it currently lacks some basic information what it is actually doing. So, start building out some logging to help others who decide to run the command. Change-Id: I27b0c444139c5772b29ae3bd2c9550c6567dd4d6 Signed-off-by: Paul Belanger --- grafana_dashboards/builder.py | 1 + grafana_dashboards/cmd.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/grafana_dashboards/builder.py b/grafana_dashboards/builder.py index 1d6aabd..2f11014 100644 --- a/grafana_dashboards/builder.py +++ b/grafana_dashboards/builder.py @@ -63,6 +63,7 @@ class Builder(object): def update_dashboard(self, path): self.load_files(path) dashboards = self.parser.data.get('dashboard', {}) + LOG.info('Number of dashboards generated: %d', len(dashboards)) for name in dashboards: data, md5 = self.parser.get_dashboard(name) if self.cache.has_changed(name, md5): diff --git a/grafana_dashboards/cmd.py b/grafana_dashboards/cmd.py index a34971b..30bc321 100644 --- a/grafana_dashboards/cmd.py +++ b/grafana_dashboards/cmd.py @@ -40,9 +40,11 @@ class Commands(object): exec_method(**kwargs) def update(self, path): + LOG.info('Updating dashboards in %s', path) self.builder.update_dashboard(path) def validate(self, path): + LOG.info('Validating dashboards in %s', path) try: self.builder.load_files(path) print('SUCCESS!') @@ -69,8 +71,8 @@ command_opt = cfg.SubCommandOpt('action', handler=add_command_parsers) def main(): CONF.register_cli_opt(command_opt) logging.register_options(CONF) - logging.setup(CONF, 'grafana-dashboard') config.prepare_args(sys.argv) + logging.setup(CONF, 'grafana-dashboard') Commands().execute() sys.exit(0)