1 /*
2 * Copyright 2009-2017 Alibaba Cloud All rights reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 
17 #pragma once
18 #include <alibabacloud/oss/Types.h>
19 
20 namespace AlibabaCloud
21 {
22 namespace OSS
23 {
24     void InitLogInner();
25     void DeinitLogInner();
26 
27     LogLevel    GetLogLevelInner();
28     LogCallback GetLogCallbackInner();
29     void SetLogLevelInner(LogLevel level);
30     void SetLogCallbackInner(LogCallback callback);
31 
32     void FormattedLog(LogLevel logLevel, const char* tag, const char* formatStr, ...);
33 
34     //#define OSS_LOG(level, tag, ...)  FormattedLog(level, tag, __VA_ARGS__)
35 
36 #ifdef DISABLE_OSS_LOGGING
37 
38     #define OSS_LOG(level, tag, ...)
39 
40 #else
41 
42     #define OSS_LOG(level, tag, ...) \
43     { \
44         if ( AlibabaCloud::OSS::GetLogCallbackInner() && AlibabaCloud::OSS::GetLogLevelInner() >= level ) \
45         { \
46             FormattedLog(level, tag, __VA_ARGS__); \
47         } \
48     }
49 
50 #endif // DISABLE_OSS_LOGGING
51 
52 }
53 }
54 
55