Merge "Allow log statements to be printed out in stdout"
This commit is contained in:
commit
b9072e8c0a
|
@ -0,0 +1,31 @@
|
|||
# Copyright (c) 2015 IBM
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
|
||||
CONF = cfg.CONF
|
||||
|
||||
_DEFAULT_LOG_LEVELS = ['castellan=WARN']
|
||||
|
||||
_DEFAULT_LOGGING_CONTEXT_FORMAT = ('%(asctime)s.%(msecs)03d %(process)d '
|
||||
'%(levelname)s %(name)s [%(request_id)s '
|
||||
'%(user_identity)s] %(instance)s'
|
||||
'%(message)s')
|
||||
|
||||
|
||||
def configure_logging():
|
||||
log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT, _DEFAULT_LOG_LEVELS)
|
||||
log.register_options(CONF)
|
|
@ -13,7 +13,10 @@
|
|||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from castellan.common import config
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import importutils
|
||||
|
||||
key_manager_opts = [
|
||||
|
@ -25,8 +28,11 @@ key_manager_opts = [
|
|||
|
||||
|
||||
def API(configuration=None):
|
||||
conf = configuration or cfg.CONF
|
||||
conf = configuration or config.CONF
|
||||
conf.register_opts(key_manager_opts, group='key_manager')
|
||||
|
||||
config.configure_logging()
|
||||
logging.setup(conf, "castellan")
|
||||
|
||||
cls = importutils.import_class(conf.key_manager.api_class)
|
||||
return cls(configuration=conf)
|
||||
|
|
Loading…
Reference in New Issue