
# 获取桶日志管理配置
#### 功能说明
获取桶的访问日志配置。
#### 方法定义
```
1. ObsClient->getBucketLogging(array $parameter)
2. ObsClient->getBucketLoggingAsync(array $parameter, callable $callback)
```
#### 请求参数
| **字段名** | **类型** | **约束** | **说明** |
|:---|:---|:---|:---|
| Bucket  | string | 必选     | 桶名。    |
   
#### 返回结果
| **字段名**      |||| **类型**            | **说明**                          |
|:--|---|---|---|:---|:---|
| HttpStatusCode |||| integer           | HTTP状态码。                        |
| Reason       |||| string            | HTTP文本描述。                       |
| RequestId    |||| string            | OBS服务端返回的请求ID。                  |
| Agency       |||| string            | 委托名。                            |
| LoggingEnabled |||| associative array | 日志配置信息。                         |
| - | TargetBucket ||| string            | 生成日志的目标桶。                       |
| - | TargetPrefix ||| string            | 在目标桶中生成日志对象的对象名前缀。              |
| - | TargetGrants ||| indexed array     | 被授权用户权限信息列表。                    |
| - | - | Grantee || associative array | 被授权用户。                          |
| - | - | - | ID  | string            | 被授权用户的DomainId，当用户类型是Group时为空。  |
| - | - | - | URI | string            | 被授权的用户组，当用户类型是CanonicalUser时为空。 |
| - | - | Permission || string            | 被授予的权限。                         |
   
#### 代码样例
```
try{
       $resp = $obsClient -> getBucketLogging([
              'Bucket' => 'bucketname'
       ]);
       printf("RequestId:%s\n", $resp['RequestId']);
       printf("LoggingEnabled[TargetBucket]:%s\n", $resp['LoggingEnabled']['TargetBucket']);
       printf("LoggingEnabled[TargetPrefix]:%s\n", $resp['LoggingEnabled']['TargetPrefix']);
       printf("TargetGrants\n");
       foreach ($resp['LoggingEnabled']['TargetGrants'] as $index => $grant){
              printf("Grants[%d]", $index + 1);
              printf("Grantee[ID]:%s\n", $grant['Grantee']['ID']);
              printf("Grantee[DisplayName]:%s\n", $grant['Grantee']['DisplayName']);
              printf("Grantee[URI]:%s\n", $grant['Grantee']['URI']);
              printf("Permission:%s\n", $grant['Permission']);
       }
}catch (Obs\Common\ObsException $obsException){
       printf("ExceptionCode:%s\n", $obsException->getExceptionCode());              
       printf("ExceptionMessage:%s\n", $obsException->getExceptionMessage());
}
```
