xref: /OK3568_Linux_fs/external/mpp/osal/windows/os_log.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 /*
2  * Copyright 2015 Rockchip Electronics Co. LTD
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 #if defined(_WIN32)
18 #include <stdio.h>
19 #include <stdarg.h>
20 
21 #define LINE_SZ 1024
22 
os_log_info(const char * tag,const char * msg,va_list list)23 void os_log_info(const char* tag, const char* msg, va_list list)
24 {
25     char line[LINE_SZ] = {0};
26     _snprintf(line, sizeof(line), "%s: %s", tag, msg);
27     vfprintf(stdout, line, list);
28 }
29 
os_log_error(const char * tag,const char * msg,va_list list)30 void os_log_error(const char* tag, const char* msg, va_list list)
31 {
32     char line[LINE_SZ] = {0};
33     _snprintf(line, sizeof(line), "%s: %s", tag, msg);
34     vfprintf(stderr, line, list);
35 }
36 
os_log_trace(const char * tag,const char * msg,va_list list)37 void os_log_trace(const char* tag, const char* msg, va_list list)
38 {
39     os_log_info(const char * tag, const char * msg, va_list list);
40 }
41 
os_log_debug(const char * tag,const char * msg,va_list list)42 void os_log_debug(const char* tag, const char* msg, va_list list)
43 {
44     os_log_info(const char * tag, const char * msg, va_list list);
45 }
46 
os_log_warn(const char * tag,const char * msg,va_list list)47 void os_log_warn(const char* tag, const char* msg, va_list list)
48 {
49     os_log_error(const char * tag, const char * msg, va_list list);
50 }
51 
os_log_fatal(const char * tag,const char * msg,va_list list)52 void os_log_fatal(const char* tag, const char* msg, va_list list)
53 {
54     os_log_error(const char * tag, const char * msg, va_list list);
55 }
56 
57 #endif
58