X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?p=o-du%2Fphy.git;a=blobdiff_plain;f=fapi_5g%2Fsource%2Futils%2Fnr5g_fapi_log.c;fp=fapi_5g%2Fsource%2Futils%2Fnr5g_fapi_log.c;h=1d4405537e8aeeb0a91cc4e971934515832b4977;hp=0000000000000000000000000000000000000000;hb=9d66fca5c45c8b3e0d6eab6d51a90c8e9d2614dc;hpb=2fbf70096f64af622da983e88c5a64e90ad9bdbd diff --git a/fapi_5g/source/utils/nr5g_fapi_log.c b/fapi_5g/source/utils/nr5g_fapi_log.c new file mode 100644 index 0000000..1d44055 --- /dev/null +++ b/fapi_5g/source/utils/nr5g_fapi_log.c @@ -0,0 +1,98 @@ +/****************************************************************************** +* +* Copyright (c) 2019 Intel. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +*******************************************************************************/ + +/** + * @file This file defines all the functions used for logging. + * + **/ +#include "nr5g_fapi_std.h" +#include "nr5g_fapi_log.h" + +nr5g_fapi_log_types_t nr5g_fapi_log_level_g; + +//------------------------------------------------------------------------------ +/** @ingroup group_lte_source_phy_api + * + * @param[in] FAPI log level + * + * @return String of log type + * + * @description The returns log level sring + * + **/ +//------------------------------------------------------------------------------ +char *get_logger_type_str( + nr5g_fapi_log_types_t e) +{ + switch (e) { + case INFO_LOG: + return ("INFO_LOG"); + + case DEBUG_LOG: + return ("DEBUG_LOG"); + + case ERROR_LOG: + return ("ERROR_LOG"); + + case TRACE_LOG: + return ("TRACE_LOG"); + + case HEXDUMP_LOG: + return ("HEXDUMP_LOG"); + + default: + printf("Log Error Type\n"); + return (""); + //case NONE: Should never be reached. + } +} + +//------------------------------------------------------------------------------ +/** @ingroup group_lte_source_phy_api + * + * @param[in] log level + * + * @return void + * + * @description The function sets log level + * + **/ +//------------------------------------------------------------------------------ +void nr5g_fapi_set_log_level( + nr5g_fapi_log_types_t new_level) +{ + nr5g_fapi_log_level_g = new_level; +} + +//------------------------------------------------------------------------------ +/** @ingroup group_lte_source_phy_api + * + * @param[in] void + * + * @return Log level + * + * @description The function returns log level. + * + **/ +//------------------------------------------------------------------------------ +nr5g_fapi_log_types_t nr5g_fapi_get_log_level( + ) +{ + return nr5g_fapi_log_level_g; +} +