memcached (openstack) is no longer in use
[mirror/dsa-puppet.git] / 3rdparty / modules / cinder / manifests / logging.pp
1 # Class cinder::logging
2 #
3 #  cinder extended logging configuration
4 #
5 # == parameters
6 #
7 #  [*logging_context_format_string*]
8 #    (optional) Format string to use for log messages with context.
9 #    Defaults to undef.
10 #    Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
11 #              [%(request_id)s %(user_identity)s] %(instance)s%(message)s'
12 #
13 #  [*logging_default_format_string*]
14 #    (optional) Format string to use for log messages without context.
15 #    Defaults to undef.
16 #    Example: '%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s\
17 #              [-] %(instance)s%(message)s'
18 #
19 #  [*logging_debug_format_suffix*]
20 #    (optional) Formatted data to append to log format when level is DEBUG.
21 #    Defaults to undef.
22 #    Example: '%(funcName)s %(pathname)s:%(lineno)d'
23 #
24 #  [*logging_exception_prefix*]
25 #    (optional) Prefix each line of exception output with this format.
26 #    Defaults to undef.
27 #    Example: '%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s'
28 #
29 #  [*log_config_append*]
30 #    The name of an additional logging configuration file.
31 #    Defaults to undef.
32 #    See https://docs.python.org/2/howto/logging.html
33 #
34 #  [*default_log_levels*]
35 #    (optional) Hash of logger (keys) and level (values) pairs.
36 #    Defaults to undef.
37 #    Example:
38 #      { 'amqp' => 'WARN', 'amqplib' => 'WARN', 'boto' => 'WARN',
39 #        'qpid' => 'WARN', 'sqlalchemy' => 'WARN', 'suds' => 'INFO',
40 #        'iso8601' => 'WARN',
41 #        'requests.packages.urllib3.connectionpool' => 'WARN' }
42 #
43 #  [*publish_errors*]
44 #    (optional) Publish error events (boolean value).
45 #    Defaults to undef (false if unconfigured).
46 #
47 #  [*fatal_deprecations*]
48 #    (optional) Make deprecations fatal (boolean value)
49 #    Defaults to undef (false if unconfigured).
50 #
51 #  [*instance_format*]
52 #    (optional) If an instance is passed with the log message, format it
53 #               like this (string value).
54 #    Defaults to undef.
55 #    Example: '[instance: %(uuid)s] '
56 #
57 #  [*instance_uuid_format*]
58 #    (optional) If an instance UUID is passed with the log message, format
59 #               it like this (string value).
60 #    Defaults to undef.
61 #    Example: instance_uuid_format='[instance: %(uuid)s] '
62
63 #  [*log_date_format*]
64 #    (optional) Format string for %%(asctime)s in log records.
65 #    Defaults to undef.
66 #    Example: 'Y-%m-%d %H:%M:%S'
67
68 class cinder::logging(
69   $logging_context_format_string = undef,
70   $logging_default_format_string = undef,
71   $logging_debug_format_suffix   = undef,
72   $logging_exception_prefix      = undef,
73   $log_config_append             = undef,
74   $default_log_levels            = undef,
75   $publish_errors                = undef,
76   $fatal_deprecations            = undef,
77   $instance_format               = undef,
78   $instance_uuid_format          = undef,
79   $log_date_format               = undef,
80 ) {
81
82   if $logging_context_format_string {
83     cinder_config {
84       'DEFAULT/logging_context_format_string' :
85         value => $logging_context_format_string;
86       }
87     }
88   else {
89     cinder_config {
90       'DEFAULT/logging_context_format_string' : ensure => absent;
91       }
92     }
93
94   if $logging_default_format_string {
95     cinder_config {
96       'DEFAULT/logging_default_format_string' :
97         value => $logging_default_format_string;
98       }
99     }
100   else {
101     cinder_config {
102       'DEFAULT/logging_default_format_string' : ensure => absent;
103       }
104     }
105
106   if $logging_debug_format_suffix {
107     cinder_config {
108       'DEFAULT/logging_debug_format_suffix' :
109         value => $logging_debug_format_suffix;
110       }
111     }
112   else {
113     cinder_config {
114       'DEFAULT/logging_debug_format_suffix' : ensure => absent;
115       }
116     }
117
118   if $logging_exception_prefix {
119     cinder_config {
120       'DEFAULT/logging_exception_prefix' : value => $logging_exception_prefix;
121       }
122     }
123   else {
124     cinder_config {
125       'DEFAULT/logging_exception_prefix' : ensure => absent;
126       }
127     }
128
129   if $log_config_append {
130     cinder_config {
131       'DEFAULT/log_config_append' : value => $log_config_append;
132       }
133     }
134   else {
135     cinder_config {
136       'DEFAULT/log_config_append' : ensure => absent;
137       }
138     }
139
140   if $default_log_levels {
141     cinder_config {
142       'DEFAULT/default_log_levels' :
143         value => join(sort(join_keys_to_values($default_log_levels, '=')), ',');
144       }
145     }
146   else {
147     cinder_config {
148       'DEFAULT/default_log_levels' : ensure => absent;
149       }
150     }
151
152   if $publish_errors {
153     cinder_config {
154       'DEFAULT/publish_errors' : value => $publish_errors;
155       }
156     }
157   else {
158     cinder_config {
159       'DEFAULT/publish_errors' : ensure => absent;
160       }
161     }
162
163   if $fatal_deprecations {
164     cinder_config {
165       'DEFAULT/fatal_deprecations' : value => $fatal_deprecations;
166       }
167     }
168   else {
169     cinder_config {
170       'DEFAULT/fatal_deprecations' : ensure => absent;
171       }
172     }
173
174   if $instance_format {
175     cinder_config {
176       'DEFAULT/instance_format' : value => $instance_format;
177       }
178     }
179   else {
180     cinder_config {
181       'DEFAULT/instance_format' : ensure => absent;
182       }
183     }
184
185   if $instance_uuid_format {
186     cinder_config {
187       'DEFAULT/instance_uuid_format' : value => $instance_uuid_format;
188       }
189     }
190   else {
191     cinder_config {
192       'DEFAULT/instance_uuid_format' : ensure => absent;
193       }
194     }
195
196   if $log_date_format {
197     cinder_config {
198       'DEFAULT/log_date_format' : value => $log_date_format;
199       }
200     }
201   else {
202     cinder_config {
203       'DEFAULT/log_date_format' : ensure => absent;
204       }
205     }
206
207
208 }