Codebase list python-castellan / 28f74a1
Allow log statements to be printed out in stdout This patch allows for log statements to be displayed in stdout. Change-Id: Ib430dd51cad125a8d0a4a4d054d45ed9346ca9fb “Fernando 8 years ago
2 changed file(s) with 38 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
0 # Copyright (c) 2015 IBM
1 # All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 from oslo_config import cfg
16 from oslo_log import log
17
18 CONF = cfg.CONF
19
20 _DEFAULT_LOG_LEVELS = ['castellan=WARN']
21
22 _DEFAULT_LOGGING_CONTEXT_FORMAT = ('%(asctime)s.%(msecs)03d %(process)d '
23 '%(levelname)s %(name)s [%(request_id)s '
24 '%(user_identity)s] %(instance)s'
25 '%(message)s')
26
27
28 def configure_logging():
29 log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT, _DEFAULT_LOG_LEVELS)
30 log.register_options(CONF)
1212 # License for the specific language governing permissions and limitations
1313 # under the License.
1414
15 from castellan.common import config
16
1517 from oslo_config import cfg
18 from oslo_log import log as logging
1619 from oslo_utils import importutils
1720
1821 key_manager_opts = [
2427
2528
2629 def API(configuration=None):
27 conf = configuration or cfg.CONF
30 conf = configuration or config.CONF
2831 conf.register_opts(key_manager_opts, group='key_manager')
32
33 config.configure_logging()
34 logging.setup(conf, "castellan")
2935
3036 cls = importutils.import_class(conf.key_manager.api_class)
3137 return cls(configuration=conf)