Add logging options
This adds various logging options to the services, and it particular sets log_dir by default. Change-Id: Icd0936777e7dfea2dd4a1d1e3f7d6abb11e3e7ae
This commit is contained in:
parent
3aff1adcb7
commit
ec305d3b3c
@ -4,6 +4,27 @@
|
|||||||
#
|
#
|
||||||
# == parameters
|
# == 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*]
|
# [*logging_context_format_string*]
|
||||||
# (optional) Format string to use for log messages with context.
|
# (optional) Format string to use for log messages with context.
|
||||||
# Defaults to $::os_service_default.
|
# Defaults to $::os_service_default.
|
||||||
@ -69,6 +90,11 @@
|
|||||||
# Example: 'Y-%m-%d %H:%M:%S'
|
# Example: 'Y-%m-%d %H:%M:%S'
|
||||||
|
|
||||||
class zaqar::logging(
|
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_context_format_string = $::os_service_default,
|
||||||
$logging_default_format_string = $::os_service_default,
|
$logging_default_format_string = $::os_service_default,
|
||||||
$logging_debug_format_suffix = $::os_service_default,
|
$logging_debug_format_suffix = $::os_service_default,
|
||||||
@ -96,6 +122,11 @@ class zaqar::logging(
|
|||||||
instance_format => $instance_format,
|
instance_format => $instance_format,
|
||||||
instance_uuid_format => $instance_uuid_format,
|
instance_uuid_format => $instance_uuid_format,
|
||||||
log_date_format => $log_date_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,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,11 @@ describe 'zaqar::logging' do
|
|||||||
:instance_format => '[instance: %(uuid)s] ',
|
:instance_format => '[instance: %(uuid)s] ',
|
||||||
:instance_uuid_format => '[instance: %(uuid)s] ',
|
:instance_uuid_format => '[instance: %(uuid)s] ',
|
||||||
:log_date_format => '%Y-%m-%d %H:%M:%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
|
end
|
||||||
|
|
||||||
@ -39,6 +44,29 @@ describe 'zaqar::logging' do
|
|||||||
|
|
||||||
end
|
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 => '<SERVICE DEFAULT>',
|
||||||
|
:use_stderr => '<SERVICE DEFAULT>',
|
||||||
|
:log_dir => '/var/log/zaqar',
|
||||||
|
:debug => '<SERVICE DEFAULT>',
|
||||||
|
)
|
||||||
|
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
|
shared_examples_for 'logging params set' do
|
||||||
it 'enables logging params' do
|
it 'enables logging params' do
|
||||||
is_expected.to contain_oslo__log('zaqar_config').with(
|
is_expected.to contain_oslo__log('zaqar_config').with(
|
||||||
|
Loading…
Reference in New Issue
Block a user