From b4b51d1ffbc0cc400d0b3b08e39ad50d02eb9ef4 Mon Sep 17 00:00:00 2001 From: Ade Lee Date: Mon, 21 Mar 2016 21:57:46 -0400 Subject: [PATCH] Moved logging to barbican-api module Change-Id: I4ca0a1edb96e6a7c5104b844a1c68a36ae3b4ef0 --- manifests/{ => api}/logging.pp | 73 +++++++++++++++---- ...g_spec.rb => barbican_api_logging_spec.rb} | 2 +- 2 files changed, 58 insertions(+), 17 deletions(-) rename manifests/{ => api}/logging.pp (57%) rename spec/classes/{barbican_logging_spec.rb => barbican_api_logging_spec.rb} (99%) diff --git a/manifests/logging.pp b/manifests/api/logging.pp similarity index 57% rename from manifests/logging.pp rename to manifests/api/logging.pp index dd71d65a..2b0b522c 100644 --- a/manifests/logging.pp +++ b/manifests/api/logging.pp @@ -1,9 +1,38 @@ -# Class barbican::logging +# Class barbican::api::logging # -# barbican extended logging configuration +# barbican-api extended logging configuration # # == parameters # +# [*verbose*] +# (Optional) Should the daemons log verbose messages +# Defaults to $::os_service_default +# +# [*debug*] +# (Optional) Should the daemons log debug messages +# Defaults to $::os_service_default +# +# [*use_syslog*] +# (Optional) Use syslog for logging. +# Defaults to $::os_service_default +# +# [*use_stderr*] +# (optional) Use stderr for logging +# Defaults to $::os_service_default +# +# [*log_facility*] +# (Optional) Syslog facility to receive log lines. +# Defaults to $::os_service_default +# +# [*log_dir*] +# (optional) Directory where logs should be stored. +# If set to boolean false, it will not log to any directory. +# Defaults to '/var/log/barbican' +# +# [*log_file*] +# (optional) File where logs should be stored. +# Defaults to '/var/log/barbican/api.log' +# # [*logging_context_format_string*] # (optional) Format string to use for log messages with context. # Defaults to $::os_service_default @@ -62,13 +91,20 @@ # it like this (string value). # Defaults to $::os_service_default # Example: instance_uuid_format='[instance: %(uuid)s] ' -# + # [*log_date_format*] # (optional) Format string for %%(asctime)s in log records. # Defaults to $::os_service_default # Example: 'Y-%m-%d %H:%M:%S' -class barbican::logging( +class barbican::api::logging( + $use_syslog = $::os_service_default, + $use_stderr = $::os_service_default, + $log_facility = $::os_service_default, + $log_dir = '/var/log/barbican', + $log_file = '/var/log/barbican/api.log', + $verbose = $::os_service_default, + $debug = $::os_service_default, $logging_context_format_string = $::os_service_default, $logging_default_format_string = $::os_service_default, $logging_debug_format_suffix = $::os_service_default, @@ -89,17 +125,22 @@ class barbican::logging( } barbican_config { - 'DEFAULT/logging_context_format_string': value => $logging_context_format_string; - 'DEFAULT/logging_default_format_string': value => $logging_default_format_string; - 'DEFAULT/logging_debug_format_suffix': value => $logging_debug_format_suffix; - 'DEFAULT/logging_exception_prefix': value => $logging_exception_prefix; - 'DEFAULT/log_config_append': value => $log_config_append; - 'DEFAULT/default_log_levels': value => $default_log_levels_real; - 'DEFAULT/publish_errors': value => $publish_errors; - 'DEFAULT/fatal_deprecations': value => $fatal_deprecations; - 'DEFAULT/instance_format': value => $instance_format; - 'DEFAULT/instance_uuid_format': value => $instance_uuid_format; - 'DEFAULT/log_date_format': value => $log_date_format; + 'DEFAULT/debug': value => $debug; + 'DEFAULT/verbose': value => $verbose; + 'DEFAULT/use_stderr': value => $use_stderr; + 'DEFAULT/use_syslog': value => $use_syslog; + 'DEFAULT/log_dir': value => $log_dir; + 'DEFAULT/syslog_log_facility': value => $log_facility; + 'DEFAULT/logging_context_format_string': value => $logging_context_format_string; + 'DEFAULT/logging_default_format_string': value => $logging_default_format_string; + 'DEFAULT/logging_debug_format_suffix': value => $logging_debug_format_suffix; + 'DEFAULT/logging_exception_prefix': value => $logging_exception_prefix; + 'DEFAULT/log_config_append': value => $log_config_append; + 'DEFAULT/default_log_levels': value => $default_log_levels_real; + 'DEFAULT/publish_errors': value => $publish_errors; + 'DEFAULT/fatal_deprecations': value => $fatal_deprecations; + 'DEFAULT/instance_format': value => $instance_format; + 'DEFAULT/instance_uuid_format': value => $instance_uuid_format; + 'DEFAULT/log_date_format': value => $log_date_format; } - } diff --git a/spec/classes/barbican_logging_spec.rb b/spec/classes/barbican_api_logging_spec.rb similarity index 99% rename from spec/classes/barbican_logging_spec.rb rename to spec/classes/barbican_api_logging_spec.rb index 18f9fcc1..74b0c14a 100644 --- a/spec/classes/barbican_logging_spec.rb +++ b/spec/classes/barbican_api_logging_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe 'barbican::logging' do +describe 'barbican::api::logging' do let :params do {