xref: /aosp_15_r20/system/chre/platform/exynos/chre_api_re.cc (revision 84e339476a462649f82315436d70fd732297a399)
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
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 #include "chre/platform/log.h"
18 #include "chre/util/macros.h"
19 
chreLog(enum chreLogLevel level,const char * formatStr,...)20 DLL_EXPORT void chreLog(enum chreLogLevel level, const char *formatStr, ...) {
21   char logBuf[512];
22   va_list args;
23 
24   va_start(args, formatStr);
25   vsnprintf(logBuf, sizeof(logBuf), formatStr, args);
26   va_end(args);
27 
28   switch (level) {
29     case CHRE_LOG_ERROR:
30       LOGE("%s", logBuf);
31       break;
32     case CHRE_LOG_WARN:
33       LOGW("%s", logBuf);
34       break;
35     case CHRE_LOG_INFO:
36       LOGI("%s", logBuf);
37       break;
38     case CHRE_LOG_DEBUG:
39     default:
40       LOGD("%s", logBuf);
41   }
42 }
43