• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 Amlogic Corporation.
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 #ifndef PLAYER_LOG_H
18 #define PLAYER_LOG_H
19 
20 #define MAX_LOG_SIZE    (20*1024)
21 
22 __attribute__((format(printf, 2, 3)))
23 void log_lprint(const int level, const char *fmt, ...);
24 
25 
26 #define AM_LOG_PANIC    0
27 #define AM_LOG_FATAL    8
28 #define AM_LOG_ERROR    16
29 #define AM_LOG_WARNING  24
30 #define AM_LOG_INFO     32
31 #define AM_LOG_VERBOSE  40
32 #define AM_LOG_DEBUG    60
33 #define AM_LOG_DEBUG1   70
34 #define AM_LOG_DEBUG2   80
35 #define AM_LOG_TRACE    90
36 
37 #ifdef ANDROID
38 #define log_print(fmt...) 	log_lprint(AM_LOG_INFO,##fmt)
39 #define log_error(fmt...) 	log_lprint(AM_LOG_ERROR,##fmt)
40 #define log_warning(fmt...) log_lprint(AM_LOG_WARNING,##fmt)
41 #define log_info(fmt...) 	log_lprint(AM_LOG_INFO,##fmt)
42 
43 #else
44 #define log_print printf
45 #define log_error printf
46 #define log_warning printf
47 #define log_info printf
48 #endif
49 
50 /*default global_level=5,
51 if the level<global_level print out
52 */
53 #define log_debug(fmt...)   log_lprint(AM_LOG_DEBUG,##fmt)
54 #define log_debug1(fmt...)  log_lprint(AM_LOG_DEBUG1,##fmt)
55 #define log_debug2(fmt...)  log_lprint(AM_LOG_DEBUG2,##fmt)
56 #define log_trace(fmt...)   log_lprint(AM_LOG_TRACE,##fmt)
57 
58 #define  DEBUG_PN() log_print("[%s:%d]\n", __FUNCTION__, __LINE__)
59 
60 void log_close(void);
61 int log_open(const char *name);
62 int update_loglevel_setting(void);
63 #endif
64