1 /*
2 * Copyright (c) 2021 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "softbus_adapter_log.h"
17
SoftBusOutPrint(const char * buf,SoftBusLogLevel level)18 void SoftBusOutPrint(const char *buf, SoftBusLogLevel level)
19 {
20 #ifdef SOFTBUS_PRINTF
21 (void)level;
22 printf("%s\n", buf);
23 return;
24 #else
25 switch (level) {
26 case SOFTBUS_LOG_DBG:
27 HILOG_DEBUG(SOFTBUS_HILOG_ID, "%{public}s", buf);
28 break;
29 case SOFTBUS_LOG_INFO:
30 HILOG_INFO(SOFTBUS_HILOG_ID, "%{public}s", buf);
31 break;
32 case SOFTBUS_LOG_WARN:
33 HILOG_WARN(SOFTBUS_HILOG_ID, "%{public}s", buf);
34 break;
35 case SOFTBUS_LOG_ERROR:
36 HILOG_ERROR(SOFTBUS_HILOG_ID, "%{public}s", buf);
37 break;
38 default:
39 break;
40 }
41 #endif
42 }
43