
shade and openstacksdk each have a logging doc and a logging setup helper function. They both basically do the same thing, and we have a TODO item about collapsing them. This moves openstack.utils.enable_logging to openstack.enable_logging (leaving behind a compat piece at openstack.utils.enable_logging) It adds the shade functionality to it, and also changes the behavior to match shade's WRT behavior when no parameters are passed (defaults to logging to stdout) Update the codebase to call openstack._log.setup_logging instead of logging.getLogger directly, as setup_logging attaches a NullHandler by default. Collapse the docs into a single document. There were only two places where openstacksdk was already logging to something other than 'openstack'. Collapse those down to 'openstack' until we come up with a reason to break them out more logically. Change-Id: I45fd5ffd18255450d38a1f56c80f5c157ea19ae3
18 lines
703 B
Python
18 lines
703 B
Python
# 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.
|
|
|
|
import openstack
|
|
openstack.enable_logging(debug=True)
|
|
|
|
cloud = openstack.openstack_cloud(cloud='rax', region_name='DFW')
|
|
print(cloud.has_service('network'))
|