Add watch_log_file option

Add support for Using logging handler designed to watch file system.

Change-Id: I427bbcd87e671be8f647ccbc4ebd00eaff8e5ae3
Closes-Bug: #1943212
This commit is contained in:
ZhongShengping 2021-09-14 16:04:53 +08:00
parent 8a12fd99de
commit 5d8522712d
2 changed files with 9 additions and 0 deletions

View File

@ -37,6 +37,10 @@
# (Optional) File where logs should be stored.
# Defaults to '/var/log/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}.log'
#
# [*watch_log_file*]
# (Optional) Uses logging handler designed to watch file system (boolean value).
# Defaults to $::os_service_default
#
# [*logging_context_format_string*]
# (Optional) Format string to use for log messages with context.
# Defaults to $::os_service_default
@ -109,6 +113,7 @@ class {{cookiecutter.project_name}}::logging(
$syslog_log_facility = $::os_service_default,
$log_dir = '/var/log/{{cookiecutter.project_name}}',
$log_file = '/var/log/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}.log',
$watch_log_file = $::os_service_default,
$debug = $::os_service_default,
$logging_context_format_string = $::os_service_default,
$logging_default_format_string = $::os_service_default,
@ -132,6 +137,7 @@ class {{cookiecutter.project_name}}::logging(
use_journal => $use_journal,
log_dir => $log_dir,
log_file => $log_file,
watch_log_file => $watch_log_file,
debug => $debug,
logging_context_format_string => $logging_context_format_string,
logging_default_format_string => $logging_default_format_string,

View File

@ -28,6 +28,7 @@ describe '{{cookiecutter.project_name}}::logging' do
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:log_file => '/var/tmp/{{cookiecutter.project_name}}_random.log',
:watch_log_file => true,
:debug => true,
}
end
@ -67,6 +68,7 @@ describe '{{cookiecutter.project_name}}::logging' do
:syslog_log_facility => '<SERVICE DEFAULT>',
:log_dir => '/var/log/{{cookiecutter.project_name}}',
:log_file => '/var/log/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}.log',
:watch_log_file => '<SERVICE DEFAULT>',
:debug => '<SERVICE DEFAULT>',
)}
end
@ -80,6 +82,7 @@ describe '{{cookiecutter.project_name}}::logging' do
:syslog_log_facility => 'LOG_FOO',
:log_dir => '/var/log',
:log_file => '/var/tmp/{{cookiecutter.project_name}}_random.log',
:watch_log_file => true,
:debug => true,
)}
end