Initial commit
[o-du/l2.git] / src / rlog / rl_common.h
1 /*******************************************************************************
2 ################################################################################
3 #   Copyright (c) [2017-2019] [Radisys]                                        #
4 #                                                                              #
5 #   Licensed under the Apache License, Version 2.0 (the "License");            #
6 #   you may not use this file except in compliance with the License.           #
7 #   You may obtain a copy of the License at                                    #
8 #                                                                              #
9 #       http://www.apache.org/licenses/LICENSE-2.0                             #
10 #                                                                              #
11 #   Unless required by applicable law or agreed to in writing, software        #
12 #   distributed under the License is distributed on an "AS IS" BASIS,          #
13 #   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   #
14 #   See the License for the specific language governing permissions and        #
15 #   limitations under the License.                                             #
16 ################################################################################
17 *******************************************************************************/
18
19 /********************************************************************20**
20
21      Name:     Radisys Logging Framework
22      Type:     C include file
23      Desc:     This file contains logging framework include file for library.
24      File:     rl_common.h
25
26 *********************************************************************21*/
27 /*************************************************************************
28 @ description: This is header file is used by logging framework module. This
29 file should not be cirectly included by any other application although it is
30 common file to logging framework and LOG MACROs used by any applicatoin.
31 ***************************************************************************/
32
33 #ifndef __RL_COMMON_H__
34 #define __RL_COMMON_H__
35
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39
40 typedef enum {
41         L_ALWAYS=0,
42         L_FATAL,
43         L_ERROR,
44         L_WARNING,
45         L_EVENT,
46         L_INFO,
47         L_DEBUG,
48         L_UNUSED,
49         L_MAX_LOG_LEVEL
50 } R_LOG_LEVEL;
51
52 typedef enum {
53         DBG_CELLID,
54    DBG_PEERID,
55    DBG_ENBID,
56         DBG_MMEID,
57         DBG_CRNTI,
58    DBG_UEIDX,
59         DBG_UEID,
60         DBG_RBID,
61         DBG_LCID,
62         DBG_LCGID,
63         DBG_TRNSID,
64    DBG_INSTID,
65         DBG_MAX_IDs
66 } R_SPL_ARG;
67
68 #ifdef USE_RLOG_DATA_TYPES
69 typedef const char* PSTR;
70 typedef unsigned char U8;
71 typedef unsigned short U16;
72 typedef unsigned int U32;
73 typedef int S32;
74 typedef signed short S16;
75 #else
76 #include "envdep.h"
77 typedef const char* PSTR;
78 #endif
79
80 typedef U32 LOGID;
81
82 #include <stdio.h>
83 extern FILE* g_fp;
84 void logLev0(PSTR strLogLevel, PSTR modName, PSTR file, int lineno, PSTR fmtStr, ...);
85 void logLev1(PSTR strLogLevel, PSTR modName, PSTR file, int lineno, PSTR fmtStr, U32 arg1, ...);
86 void logLev2(PSTR strLogLevel, PSTR modName, PSTR file, int lineno, PSTR fmtStr, U32 arg1, U32 arg2, ...);
87 void logLev3(PSTR strLogLevel, PSTR modName, PSTR file, int lineno, PSTR fmtStr, U32, U32, U32, ...);
88 void logLev4(PSTR strLogLevel, PSTR modName, PSTR file, int lineno, PSTR fmtStr, U32, U32, U32, U32, ...);
89 void logLevN(int logLevel, const char* modName, const char* file, int lineno, const char* fmtStr, ...);
90 void logLevE(PSTR strLogLevel, PSTR modName, PSTR file, int lineno, PSTR fmtStr, R_SPL_ARG splType,
91    U32 splVal, U32 arg1, U32 arg2, U32 arg3, U32 arg4, ...);
92 void logLevH(PSTR strLogLevel, PSTR modName, PSTR file, int lineno, PSTR fmtStr, PSTR hexdump, int hexlen, ...);
93 void logLevS(PSTR strLogLevel, PSTR modName, PSTR file, int lineno, PSTR fmtStr, PSTR str, ...);
94
95 void hextostr(char* p, PSTR h, int hexlen);
96
97 extern int g_logLevel;
98 extern U32 g_modMask;
99 extern const char* g_logStr[L_MAX_LOG_LEVEL]; 
100 extern const char* g_splStr[DBG_MAX_IDs];
101
102 #define RLOG_SEGFAULT_STR "Segmentation Fault Occurred\n%s"
103
104 #ifdef __cplusplus
105 }
106 #endif /* __cplusplus */
107
108 #endif /* __RLOG_COMMON_H__ */