diff --git a/doc/source/grafana-dashboard.rst b/doc/source/grafana-dashboard.rst index 422ae0a..1bf42dd 100644 --- a/doc/source/grafana-dashboard.rst +++ b/doc/source/grafana-dashboard.rst @@ -26,10 +26,9 @@ OPTIONS --config-file PATH Path to a config file to use. Multiple config files can be specified, with values in later files taking precedence. The default files used are: None. --d, --debug Print debugging output(set logging level to DEBUG - instead of default WARNING level). --v, --verbose Print more verbose output (set logging level to INFO - instead of default WARNING level). +--debug Print debugging output(set logging level to DEBUG instead + of default INFO level). +--nodebug The inverse of --debug. --version Show program's version number and exit. COMMANDS diff --git a/etc/grafyaml.conf b/etc/grafyaml.conf index d8ca7f4..3cc9e76 100644 --- a/etc/grafyaml.conf +++ b/etc/grafyaml.conf @@ -1,91 +1,5 @@ [DEFAULT] -# -# From oslo.log -# - -# Print debugging output (set logging level to DEBUG instead of -# default WARNING level). (boolean value) -#debug = false - -# Print more verbose output (set logging level to INFO instead of -# default WARNING level). (boolean value) -#verbose = false - -# The name of a logging configuration file. This file is appended to -# any existing logging configuration files. For details about logging -# configuration files, see the Python logging module documentation. -# (string value) -# Deprecated group/name - [DEFAULT]/log_config -#log_config_append = - -# DEPRECATED. A logging.Formatter log message format string which may -# use any of the available logging.LogRecord attributes. This option -# is deprecated. Please use logging_context_format_string and -# logging_default_format_string instead. (string value) -#log_format = - -# Format string for %%(asctime)s in log records. Default: %(default)s -# . (string value) -#log_date_format = %Y-%m-%d %H:%M:%S - -# (Optional) Name of log file to output to. If no default is set, -# logging will go to stdout. (string value) -# Deprecated group/name - [DEFAULT]/logfile -#log_file = - -# (Optional) The base directory used for relative --log-file paths. -# (string value) -# Deprecated group/name - [DEFAULT]/logdir -#log_dir = - -# Use syslog for logging. Existing syslog format is DEPRECATED during -# I, and will change in J to honor RFC5424. (boolean value) -#use_syslog = false - -# (Optional) Enables or disables syslog rfc5424 format for logging. If -# enabled, prefixes the MSG part of the syslog message with APP-NAME -# (RFC5424). The format without the APP-NAME is deprecated in I, and -# will be removed in J. (boolean value) -#use_syslog_rfc_format = false - -# Syslog facility to receive log lines. (string value) -#syslog_log_facility = LOG_USER - -# Log output to standard error. (boolean value) -#use_stderr = true - -# Format string to use for log messages with context. (string value) -#logging_context_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s - -# Format string to use for log messages without context. (string -# value) -#logging_default_format_string = %(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s - -# Data to append to log format when level is DEBUG. (string value) -#logging_debug_format_suffix = %(funcName)s %(pathname)s:%(lineno)d - -# Prefix each line of exception output with this format. (string -# value) -#logging_exception_prefix = %(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s - -# List of logger=LEVEL pairs. (list value) -#default_log_levels = amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN,urllib3.connectionpool=WARN,websocket=WARN,requests.packages.urllib3.util.retry=WARN,urllib3.util.retry=WARN,keystonemiddleware=WARN,routes.middleware=WARN,stevedore=WARN - -# Enables or disables publication of error events. (boolean value) -#publish_errors = false - -# Enables or disables fatal status of deprecations. (boolean value) -#fatal_deprecations = false - -# The format for an instance that is passed with the log message. -# (string value) -#instance_format = "[instance: %(uuid)s] " - -# The format for an instance UUID that is passed with the log message. -# (string value) -#instance_uuid_format = "[instance: %(uuid)s] " - [grafana] diff --git a/grafana_dashboards/builder.py b/grafana_dashboards/builder.py index 2f11014..c00bbbe 100644 --- a/grafana_dashboards/builder.py +++ b/grafana_dashboards/builder.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. +import logging import os from oslo_config import cfg -from oslo_log import log as logging from grafana_dashboards.cache import Cache from grafana_dashboards.grafana import Grafana diff --git a/grafana_dashboards/cache.py b/grafana_dashboards/cache.py index 40b6c67..4719050 100644 --- a/grafana_dashboards/cache.py +++ b/grafana_dashboards/cache.py @@ -12,11 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. +import logging import os from dogpile.cache.region import make_region from oslo_config import cfg -from oslo_log import log as logging cache_opts = [ cfg.StrOpt( diff --git a/grafana_dashboards/cmd.py b/grafana_dashboards/cmd.py index 30bc321..70cf9f4 100644 --- a/grafana_dashboards/cmd.py +++ b/grafana_dashboards/cmd.py @@ -13,10 +13,10 @@ # under the License. import inspect +import logging import sys from oslo_config import cfg -from oslo_log import log as logging from grafana_dashboards.builder import Builder from grafana_dashboards import config @@ -66,13 +66,19 @@ def add_command_parsers(subparsers): command_opt = cfg.SubCommandOpt('action', handler=add_command_parsers) +logging_opts = cfg.BoolOpt( + 'debug', default=False, help='Print debugging output (set logging level ' + 'to DEBUG instead of default INFO level).') def main(): CONF.register_cli_opt(command_opt) - logging.register_options(CONF) + CONF.register_cli_opt(logging_opts) config.prepare_args(sys.argv) - logging.setup(CONF, 'grafana-dashboard') + if CONF.debug: + logging.basicConfig(level=logging.DEBUG) + else: + logging.basicConfig(level=logging.INFO) Commands().execute() sys.exit(0) diff --git a/requirements.txt b/requirements.txt index 4c8b3fa..05b1edc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,5 @@ -# The order of packages is significant, because pip processes them in the order -# of appearance. Changing the order has an impact on the overall integration -# process, which may cause wedges in the gate later. - dogpile.cache oslo.config>=1.11.0 -oslo.log>=1.0.0,<1.1.0 python-slugify PyYAML>=3.1.0 requests