mcl_log_util.h
Go to the documentation of this file.
1 /*!**********************************************************************
2 *
3 * @copyright Copyright (C) 2017 Siemens Aktiengesellschaft.\n
4 * All rights reserved.
5 *
6 *************************************************************************
7 *
8 * @file mcl_log_util.h
9 * @date Jan 30, 2017
10 * @brief Log utility module interface header file.
11 *
12 * This utility module defines macros and functions for logging purposes.
13 *
14 ************************************************************************/
15 
16 #ifndef MCL_LOG_UTIL_H_
17 #define MCL_LOG_UTIL_H_
18 
19 #include "mcl/mcl_common.h"
20 #include <stdarg.h>
21 
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif
26 
30  typedef enum E_LOG_OUTPUT
31  {
37  } E_LOG_OUTPUT;
38 
46  typedef void (*mcl_log_util_callback_t)(int log_level, const char *tag, const char *message, void *user_context);
47 
64  extern MCL_EXPORT E_MCL_ERROR_CODE mcl_log_util_set_output_level(const int log_level);
65 
84  extern MCL_EXPORT E_MCL_ERROR_CODE mcl_log_util_initialize(E_LOG_OUTPUT log_output, ...);
85 
95  extern MCL_EXPORT void mcl_log_util_finalize(void);
96 
104 
105 #ifdef __cplusplus
106 }
107 #endif
108 
109 #endif //MCL_LOG_UTIL_H_
#define MCL_EXPORT
Common module interface header file.
Log output channel is stderr.
Definition: mcl_log_util.h:35
MCL_EXPORT E_MCL_ERROR_CODE mcl_log_util_set_output_level(const int log_level)
Sets the global output level. The output level is used during runtime check. No logs are written if g...
Definition: log_util.c:174
Log output channel is file.
Definition: mcl_log_util.h:32
MCL_EXPORT const char * mcl_log_util_convert_error_code_to_string(E_MCL_ERROR_CODE error_code)
This function converts the given error code to its string value.
Definition: log_util.c:250
E_MCL_ERROR_CODE
MCL Error code definitions. Every function returning an error code uses this enum values...
Definition: mcl_common.h:137
MCL_EXPORT void mcl_log_util_finalize(void)
Performs finalizing operations for logging.
Definition: log_util.c:230
void(* mcl_log_util_callback_t)(int log_level, const char *tag, const char *message, void *user_context)
Log util callback function definition.
Definition: mcl_log_util.h:46
Log output channel is callback.
Definition: mcl_log_util.h:33
No log output chosen.
Definition: mcl_log_util.h:36
MCL_EXPORT E_MCL_ERROR_CODE mcl_log_util_initialize(E_LOG_OUTPUT log_output,...)
This function initializes logging where output channel is set and configured via variable arguments...
Definition: log_util.c:185
Log output channel is syslog.
Definition: mcl_log_util.h:34
E_LOG_OUTPUT
MCL Log output definitions.
Definition: mcl_log_util.h:30