diff --git a/manifests/logging.pp b/manifests/logging.pp index f65ac01..e04b09d 100644 --- a/manifests/logging.pp +++ b/manifests/logging.pp @@ -4,6 +4,27 @@ # # == parameters # +# [*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 $::os_service_default, it will not log to any directory. +# Defaults to '/var/log/zaqar' +# # [*logging_context_format_string*] # (optional) Format string to use for log messages with context. # Defaults to $::os_service_default. @@ -69,6 +90,11 @@ # Example: 'Y-%m-%d %H:%M:%S' class zaqar::logging( + $use_syslog = $::os_service_default, + $use_stderr = $::os_service_default, + $log_facility = $::os_service_default, + $log_dir = '/var/log/zaqar', + $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, @@ -96,6 +122,11 @@ class zaqar::logging( instance_format => $instance_format, instance_uuid_format => $instance_uuid_format, log_date_format => $log_date_format, + use_syslog => $use_syslog, + use_stderr => $use_stderr, + syslog_log_facility => $log_facility, + log_dir => $log_dir, + debug => $debug, } } diff --git a/spec/classes/zaqar_logging_spec.rb b/spec/classes/zaqar_logging_spec.rb index c89506e..69fe777 100644 --- a/spec/classes/zaqar_logging_spec.rb +++ b/spec/classes/zaqar_logging_spec.rb @@ -23,6 +23,11 @@ describe 'zaqar::logging' do :instance_format => '[instance: %(uuid)s] ', :instance_uuid_format => '[instance: %(uuid)s] ', :log_date_format => '%Y-%m-%d %H:%M:%S', + :use_syslog => true, + :use_stderr => false, + :log_facility => 'LOG_FOO', + :log_dir => '/var/log', + :debug => true, } end @@ -39,6 +44,29 @@ describe 'zaqar::logging' do end + shared_examples 'basic default logging settings' do + it 'configures zaqar logging settings with default values' do + is_expected.to contain_oslo__log('zaqar_config').with( + :use_syslog => '', + :use_stderr => '', + :log_dir => '/var/log/zaqar', + :debug => '', + ) + end + end + + shared_examples 'basic non-default logging settings' do + it 'configures zaqar logging settings with non-default values' do + is_expected.to contain_oslo__log('zaqar_config').with( + :use_syslog => true, + :use_stderr => false, + :syslog_log_facility => 'LOG_FOO', + :log_dir => '/var/log', + :debug => true, + ) + end + end + shared_examples_for 'logging params set' do it 'enables logging params' do is_expected.to contain_oslo__log('zaqar_config').with(