本文整理汇总了Python中boto3.set_stream_logger方法的典型用法代码示例。如果您正苦于以下问题:Python boto3.set_stream_logger方法的具体用法?Python boto3.set_stream_logger怎么用?Python boto3.set_stream_logger使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto3
的用法示例。
在下文中一共展示了boto3.set_stream_logger方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import set_stream_logger [as 别名]
def get(self, path=""):
"""
Takes a path and returns lists of files/objects
and directories/prefixes based on the path.
"""
boto3.set_stream_logger("boto3.resources", logging.DEBUG)
boto3.set_stream_logger("botocore", logging.DEBUG)
try:
if not self.s3:
self.s3 = S3Resource(self.config).s3_resource
result = get_s3_objects_from_path(self.s3, path)
except S3ResourceNotFoundException as e:
print(e)
result = {
"error": 404,
"message": "The requested resource could not be found.",
}
except Exception as e:
print(e)
result = {"error": 500, "message": str(e)}
self.finish(json.dumps(result))
示例2: session
# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import set_stream_logger [as 别名]
def session(self):
'''Get a low-level session object or create one if needed'''
if not self._session:
if self.config.debug_mode:
boto3.set_stream_logger(level=log.DEBUG)
self._session = boto3.session.Session(
region_name=self.region_name, **self.session_cfg)
return self._session
示例3: sync
# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import set_stream_logger [as 别名]
def sync(config, parameter, suffix, debug, confirm, yes):
confirm = confirm or yes
if debug:
LOGGER.setLevel(logging.DEBUG)
boto3.set_stream_logger(name='boto3', level=logging.DEBUG)
boto3.set_stream_logger(name='botocore', level=logging.DEBUG)
else:
LOGGER.setLevel(logging.INFO)
if confirm:
LOGGER.info("This action will modify AWS infrastructure in account: {0}".format(
get_first_account_alias_or_account_id()))
else:
check_update_available()
click.confirm('This action will modify AWS infrastructure in account: {0}\nAre you sure?'.format(
get_first_account_alias_or_account_id()), abort=True)
try:
config = Config(config_file=config, cli_params=parameter, stack_name_suffix=suffix)
StackActionHandler(config).create_or_update_stacks()
except CfnSphereException as e:
LOGGER.error(e)
if debug:
LOGGER.exception(e)
sys.exit(1)
except Exception as e:
LOGGER.error("Failed with unexpected error")
LOGGER.exception(e)
LOGGER.info("Please report at https://github.com/cfn-sphere/cfn-sphere/issues!")
sys.exit(1)
示例4: __init__
# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import set_stream_logger [as 别名]
def __init__(self, region, retries=100):
boto3.set_stream_logger('boto3', logging.INFO)
self.session = boto3.Session()
self.region = region
self.retries = retries
self._ec2_client = None
self._ec2_resource = None
self._cloudwatch_client = None
self._iam_client = None
示例5: experiment_obj
# 需要导入模块: import boto3 [as 别名]
# 或者: from boto3 import set_stream_logger [as 别名]
def experiment_obj(sagemaker_boto_client):
description = "{}-{}".format("description", str(uuid.uuid4()))
boto3.set_stream_logger("", logging.INFO)
experiment_obj = experiment.Experiment.create(
experiment_name=name(), description=description, sagemaker_boto_client=sagemaker_boto_client
)
yield experiment_obj
time.sleep(0.5)
experiment_obj.delete()