Replace oslo_log dependency with standard logging
When I first started grafyaml, I wanted to better understand how existing OpenStack libraries worked. So, with that in mind, I choose oslo_log as the logging class for this program. However, now that we have imported it under openstack-infra, we don't really want to depend on OpenStack libraries, incase there is a breakage. The main reason for this, if OpenStack libraries break, we still want the infrastructure to work so we can fix the problem. Change-Id: Iee9b1d9d9abb4da4d285531b64a7e2505240be12 Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
parent
29fbf5e7d1
commit
3a66817727
@ -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
|
||||
|
@ -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 = <None>
|
||||
|
||||
# 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 = <None>
|
||||
|
||||
# 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 = <None>
|
||||
|
||||
# (Optional) The base directory used for relative --log-file paths.
|
||||
# (string value)
|
||||
# Deprecated group/name - [DEFAULT]/logdir
|
||||
#log_dir = <None>
|
||||
|
||||
# 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]
|
||||
|
||||
|
@ -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
|
||||
|
@ -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(
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user