Merge "Moving DPDK Verion From 16.11 to 18.11. Updated the related section in usergui...
[barometer.git] / puppet-barometer / manifests / logging.pp
1 # Class barometer::logging
2 #
3 #  barometer logging configuration
4 #
5 # == parameters
6 #
7 #  [*debug*]
8 #    (Optional) Should the daemons log debug messages
9 #    Defaults to $::os_service_default
10 #
11 #  [*use_syslog*]
12 #    (Optional) Use syslog for logging.
13 #    Defaults to $::os_service_default
14 #
15 #  [*use_stderr*]
16 #    (optional) Use stderr for logging
17 #    Defaults to $::os_service_default
18 #
19 #  [*syslog_log_facility*]
20 #    (Optional) Syslog facility to receive log lines.
21 #    Defaults to $::os_service_default
22 #
23 #  [*log_dir*]
24 #    (optional) Directory where logs should be stored.
25 #    If set to boolean false, it will not log to any directory.
26 #    Defaults to '/var/log/barometer'.
27 #
28 #  [*log_file*]
29 #    (optional) File where logs should be stored.
30 #    Defaults to '/var/log/barometer/barometer.log'
31 #
32 #  [*logging_context_format_string*]
33 #    (optional) Format string to use for log messages with context.
34 #    Defaults to $::os_service_default
35 #    Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
36 #              [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
37 #
38 #  [*logging_default_format_string*]
39 #    (optional) Format string to use for log messages without context.
40 #    Defaults to $::os_service_default
41 #    Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
42 #              [-] %(instance)s%(message)s'
43 #
44 #  [*logging_debug_format_suffix*]
45 #    (optional) Formatted data to append to log format when level is DEBUG.
46 #    Defaults to $::os_service_default
47 #    Example: '%(funcName)s %(pathname)s:%(lineno)d'
48 #
49 #  [*logging_exception_prefix*]
50 #    (optional) Prefix each line of exception output with this format.
51 #    Defaults to $::os_service_default
52 #    Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
53 #
54 #  [*log_config_append*]
55 #    (optional) The name of an additional logging configuration file.
56 #    Defaults to $::os_service_default
57 #    See https://docs.python.org/2/howto/logging.html
58 #
59 #  [*default_log_levels*]
60 #    (optional) Hash of logger (keys) and level (values) pairs.
61 #    Defaults to $::os_service_default
62 #    Example:
63 #      { 'amqp'  => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
64 #           'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
65 #           'oslo.messaging' => 'INFO', 'iso8601' => 'WARN',
66 #           'requests.packages.urllib3.connectionpool' => 'WARN',
67 #           'urllib3.connectionpool' => 'WARN',
68 #           'websocket' => 'WARN', 'barometermiddleware' => 'WARN',
69 #           'routes.middleware' => 'WARN', stevedore => 'WARN' }
70 #
71 #  [*publish_errors*]
72 #    (optional) Publish error events (boolean value).
73 #    Defaults to $::os_service_default
74 #
75 #  [*fatal_deprecations*]
76 #    (optional) Make deprecations fatal (boolean value)
77 #    Defaults to $::os_service_default
78 #
79 #  [*instance_format*]
80 #    (optional) If an instance is passed with the log message, format it
81 #               like this (string value).
82 #    Defaults to undef.
83 #    Example: '[instance: %(uuid)s] '
84 #
85 #  [*instance_uuid_format*]
86 #    (optional) If an instance UUID is passed with the log message, format
87 #               it like this (string value).
88 #    Defaults to $::os_service_default
89 #    Example: instance_uuid_format='[instance: %(uuid)s] '
90 #
91 #  [*log_date_format*]
92 #    (optional) Format string for %%(asctime)s in log records.
93 #    Defaults to $::os_service_default
94 #    Example: 'Y-%m-%d %H:%M:%S'
95
96 class barometer::logging(
97   $use_syslog                    = $::os_service_default,
98   $use_stderr                    = $::os_service_default,
99   $syslog_log_facility           = $::os_service_default,
100   $log_dir                       = '/var/log/barometer',
101   $log_file                      = '/var/log/barometer/barometer.log',
102   $debug                         = $::os_service_default,
103   $logging_context_format_string = $::os_service_default,
104   $logging_default_format_string = $::os_service_default,
105   $logging_debug_format_suffix   = $::os_service_default,
106   $logging_exception_prefix      = $::os_service_default,
107   $log_config_append             = $::os_service_default,
108   $default_log_levels            = $::os_service_default,
109   $publish_errors                = $::os_service_default,
110   $fatal_deprecations            = $::os_service_default,
111   $instance_format               = $::os_service_default,
112   $instance_uuid_format          = $::os_service_default,
113   $log_date_format               = $::os_service_default,
114 ) {
115
116   oslo::log { 'barometer_config':
117     use_stderr                    => $use_stderr,
118     use_syslog                    => $use_syslog,
119     log_dir                       => $log_dir,
120     log_file                      => $log_file,
121     debug                         => $debug,
122     logging_context_format_string => $logging_context_format_string,
123     logging_default_format_string => $logging_default_format_string,
124     logging_debug_format_suffix   => $logging_debug_format_suffix,
125     logging_exception_prefix      => $logging_exception_prefix,
126     log_config_append             => $log_config_append,
127     default_log_levels            => $default_log_levels,
128     publish_errors                => $publish_errors,
129     fatal_deprecations            => $fatal_deprecations,
130     instance_format               => $instance_format,
131     instance_uuid_format          => $instance_uuid_format,
132     log_date_format               => $log_date_format,
133     syslog_log_facility           => $syslog_log_facility,
134   }
135 }