1d4405537e8aeeb0a91cc4e971934515832b4977
[o-du/phy.git] / fapi_5g / source / utils / nr5g_fapi_log.c
1 /******************************************************************************
2 *
3 *   Copyright (c) 2019 Intel.
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  * @file This file defines all the functions used for logging. 
21  *
22  **/
23 #include "nr5g_fapi_std.h"
24 #include "nr5g_fapi_log.h"
25
26 nr5g_fapi_log_types_t nr5g_fapi_log_level_g;
27
28 //------------------------------------------------------------------------------
29 /** @ingroup        group_lte_source_phy_api
30  *
31  *  @param[in]      FAPI log level
32  *
33  *  @return         String of log type
34  *
35  *  @description    The returns log level sring
36  *
37  **/
38 //------------------------------------------------------------------------------
39 char *get_logger_type_str(
40     nr5g_fapi_log_types_t e)
41 {
42     switch (e) {
43         case INFO_LOG:
44             return ("INFO_LOG");
45
46         case DEBUG_LOG:
47             return ("DEBUG_LOG");
48
49         case ERROR_LOG:
50             return ("ERROR_LOG");
51
52         case TRACE_LOG:
53             return ("TRACE_LOG");
54
55         case HEXDUMP_LOG:
56             return ("HEXDUMP_LOG");
57
58         default:
59             printf("Log Error Type\n");
60             return ("");
61             //case NONE: Should never be reached.
62     }
63 }
64
65 //------------------------------------------------------------------------------
66 /** @ingroup        group_lte_source_phy_api
67  *
68  *  @param[in]      log level
69  *
70  *  @return         void
71  *
72  *  @description    The function sets log level
73  *
74  **/
75 //------------------------------------------------------------------------------
76 void nr5g_fapi_set_log_level(
77     nr5g_fapi_log_types_t new_level)
78 {
79     nr5g_fapi_log_level_g = new_level;
80 }
81
82 //------------------------------------------------------------------------------
83 /** @ingroup        group_lte_source_phy_api
84  *
85  *  @param[in]      void
86  *
87  *  @return         Log level
88  *
89  *  @description    The function returns log level.
90  *
91  **/
92 //------------------------------------------------------------------------------
93 nr5g_fapi_log_types_t nr5g_fapi_get_log_level(
94     )
95 {
96     return nr5g_fapi_log_level_g;
97 }
98