本文整理汇总了Python中oslo_log.log.set_defaults方法的典型用法代码示例。如果您正苦于以下问题:Python log.set_defaults方法的具体用法?Python log.set_defaults怎么用?Python log.set_defaults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类oslo_log.log
的用法示例。
在下文中一共展示了log.set_defaults方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: parse_args
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def parse_args(argv, default_config_files=None, configure_db=True,
init_rpc=True):
log.register_options(CONF)
# We use the oslo.log default log levels which includes suds=INFO
# and add only the extra levels that Masakari needs
log.set_defaults(default_log_levels=log.get_default_log_levels())
rpc.set_defaults(control_exchange='masakari')
config.set_middleware_defaults()
CONF(argv[1:],
project='masakari',
version=version.version_string(),
default_config_files=default_config_files)
if init_rpc:
rpc.init(CONF)
if configure_db:
sqlalchemy_api.configure(CONF)
示例2: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def main():
config.parse_args(sys.argv, 'senlin-conductor')
logging.setup(CONF, 'senlin-conductor')
logging.set_defaults()
gmr.TextGuruMeditation.setup_autorun(version)
objects.register_all()
messaging.setup()
from senlin.conductor import service as conductor
profiler.setup('senlin-conductor', CONF.host)
srv = conductor.ConductorService(CONF.host, consts.CONDUCTOR_TOPIC)
launcher = service.launch(CONF, srv,
workers=CONF.conductor.workers,
restart_method='mutate')
# the following periodic tasks are intended serve as HA checking
# srv.create_periodic_tasks()
launcher.wait()
示例3: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def main():
config.parse_args(sys.argv, 'senlin-engine')
logging.setup(CONF, 'senlin-engine')
logging.set_defaults()
gmr.TextGuruMeditation.setup_autorun(version)
objects.register_all()
messaging.setup()
from senlin.engine import service as engine
profiler.setup('senlin-engine', CONF.host)
srv = engine.EngineService(CONF.host,
consts.ENGINE_TOPIC)
launcher = service.launch(CONF, srv,
workers=CONF.engine.workers,
restart_method='mutate')
launcher.wait()
示例4: main
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def main():
config.parse_args(sys.argv, 'senlin-health-manager')
logging.setup(CONF, 'senlin-health-manager')
logging.set_defaults()
gmr.TextGuruMeditation.setup_autorun(version)
objects.register_all()
messaging.setup()
from senlin.health_manager import service as health_manager
profiler.setup('senlin-health-manager', CONF.host)
srv = health_manager.HealthManagerService(CONF.host,
consts.HEALTH_MANAGER_TOPIC)
launcher = service.launch(CONF, srv,
workers=CONF.health_manager.workers,
restart_method='mutate')
launcher.wait()
示例5: set_cors_middleware_defaults
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def set_cors_middleware_defaults():
"""Update default configuration options for oslo.middleware."""
cors.set_defaults(
allow_headers=['X-Auth-Token',
'X-Identity-Status',
'X-Roles',
'X-Service-Catalog',
'X-User-Id',
'X-Tenant-Id',
'X-Project-Id',
'X-User-Name',
'X-Project-Name'],
allow_methods=['GET',
'PUT',
'POST',
'DELETE',
'PATCH'],
expose_headers=['X-Auth-Token',
'X-Subject-Token',
'X-Service-Token',
'X-Project-Id',
'X-User-Name',
'X-Project-Name']
)
示例6: parse_args
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def parse_args(argv, default_config_files=None):
log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT, _DEFAULT_LOG_LEVELS)
log.register_options(CONF)
options.set_defaults(CONF, connection=_DEFAULT_SQL_CONNECTION)
cfg.CONF(argv[1:],
project='ec2api',
version=version.version_info.version_string(),
default_config_files=default_config_files)
示例7: setup_logging
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def setup_logging():
logging.setup(CONF, 'kuryr-kubernetes')
logging.set_defaults(default_log_levels=logging.get_default_log_levels())
version_k8s = version.version_info.version_string()
LOG.info("Logging enabled!")
LOG.info("%(prog)s version %(version)s",
{'prog': sys.argv[0], 'version': version_k8s})
示例8: enable_logging
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def enable_logging(conf=None, app_name='castellan'):
conf = conf or cfg.CONF
log.register_options(conf)
log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT,
_DEFAULT_LOG_LEVELS)
log.setup(conf, app_name)
示例9: add_command_parsers
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def add_command_parsers(subparsers):
for name in ['current', 'history', 'branches']:
parser = add_alembic_subparser(subparsers, name)
parser.set_defaults(func=do_alembic_command)
help_text = (getattr(alembic_cmd, 'branches').__doc__ +
' and validate head file')
parser = subparsers.add_parser('check_migration', help=help_text)
parser.set_defaults(func=do_check_migration)
parser = add_alembic_subparser(subparsers, 'upgrade')
parser.add_argument('--delta', type=int)
parser.add_argument('--sql', action='store_true')
parser.add_argument('revision', nargs='?')
parser.set_defaults(func=do_upgrade)
parser = subparsers.add_parser(
"upgrade_persistence",
help="Run migrations for persistence backend")
parser.set_defaults(func=do_persistence_upgrade)
parser = subparsers.add_parser('downgrade', help="(No longer supported)")
parser.add_argument('None', nargs='?', help="Downgrade not supported")
parser.set_defaults(func=no_downgrade)
parser = add_alembic_subparser(subparsers, 'stamp')
parser.add_argument('--sql', action='store_true')
parser.add_argument('revision')
parser.set_defaults(func=do_stamp)
parser = add_alembic_subparser(subparsers, 'revision')
parser.add_argument('-m', '--message')
parser.add_argument('--autogenerate', action='store_true')
parser.add_argument('--sql', action='store_true')
parser.set_defaults(func=do_revision)
示例10: setup_logging
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def setup_logging(conf):
"""Sets up the logging options for a log with supplied name.
:param conf: a cfg.ConfOpts object
"""
logging.set_defaults(default_log_levels=logging.get_default_log_levels() +
EXTRA_LOG_LEVEL_DEFAULTS)
product_name = "octavia"
logging.setup(conf, product_name)
LOG.info("Logging enabled!")
LOG.info("%(prog)s version %(version)s",
{'prog': sys.argv[0],
'version': version.version_info.release_string()})
LOG.debug("command line: %s", " ".join(sys.argv))
示例11: setup_logging
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def setup_logging():
_DEFAULT_LOG_LEVELS = ['amqp=WARN', 'amqplib=WARN', 'boto=WARN',
'stevedore=WARN', 'oslo_log=INFO',
'iso8601=WARN', 'elasticsearch=WARN',
'requests.packages.urllib3.connectionpool=WARN',
'urllib3.connectionpool=WARN', 'websocket=WARN',
'keystonemiddleware=WARN', 'routes.middleware=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')
log.set_defaults(_DEFAULT_LOGGING_CONTEXT_FORMAT, _DEFAULT_LOG_LEVELS)
log.setup(CONF, 'freezer-api', version=FREEZER_API_VERSION)
示例12: __init__
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def __init__(self):
self.logger = LOG
logging.set_defaults(default_log_levels=CONF.default_log_levels)
logging.setup(CONF, 'armada')
示例13: set_default_for_default_log_levels
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def set_default_for_default_log_levels():
"""Set the default for the default_log_levels option for Armada.
Armada uses some packages that other OpenStack services don't use that do
logging. This will set the default_log_levels default level for those
packages.
This function needs to be called before CONF().
"""
extra_log_level_defaults = ['kubernetes.client.rest=INFO']
log.set_defaults(
default_log_levels=log.get_default_log_levels()
+ extra_log_level_defaults, )
示例14: create
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def create(enable_middleware=CONF.middleware):
"""Entry point for initializing Armada server.
:param enable_middleware: Whether to enable middleware.
:type enable_middleware: bool
"""
if enable_middleware:
api = falcon.API(
request_type=ArmadaRequest,
middleware=[
AuthMiddleware(),
ContextMiddleware(),
LoggingMiddleware(),
])
else:
api = falcon.API(request_type=ArmadaRequest)
logging.set_defaults(default_log_levels=CONF.default_log_levels)
logging.setup(CONF, 'armada')
# Configure API routing
url_routes_v1 = (
('health', Health()),
('apply', Apply()),
('releases', Release()),
('status', Status()),
('tests', TestReleasesManifestController()),
('test/{release}', TestReleasesReleaseNameController()),
('validatedesign', Validate()),
)
for route, service in url_routes_v1:
api.add_route("/api/v1.0/{}".format(route), service)
api.add_route('/versions', Versions())
# Initialize policy config options.
policy.Enforcer(CONF)
return api
示例15: __init__
# 需要导入模块: from oslo_log import log [as 别名]
# 或者: from oslo_log.log import set_defaults [as 别名]
def __init__(self):
self.logger = LOG
logging.register_options(CONF)
logging.set_defaults(default_log_levels=CONF.default_log_levels)
logging.setup(CONF, 'armada')