XDK API  3.6.0
Documentation
Data Structures | Macros | Typedefs | Functions
Serval_Log.h File Reference

Logging ModuleThis module provides function to handle the logging. The logging can be done via UART or UDP/IP. The logging can be done in different modes (e.g. debugging). More...

#include <Serval_Types.h>
#include <Serval_Defines.h>
#include <Serval_Exceptions.h>
+ Include dependency graph for Serval_Log.h:
+ This graph shows which files directly or indirectly include this file:

Data Structures

struct  LogAppender_S
 

Macros

#define LOG_DEBUG(...)
 
#define LOG_DEBUG_LEN(ptr, len)
 
#define LOG_ERROR(...)   Log_flog(SERVAL_LOG_LEVEL_ERROR, LOG_MODULE, __VA_ARGS__)
 
#define LOG_ERROR_LEN(ptr, len)   Log_log(SERVAL_LOG_LEVEL_ERROR, LOG_MODULE, ptr, len)
 
#define LOG_FATAL(...)   Log_flog(SERVAL_LOG_LEVEL_FATAL, LOG_MODULE, __VA_ARGS__)
 
#define LOG_FATAL_LEN(ptr, len)   Log_log(SERVAL_LOG_LEVEL_FATAL, LOG_MODULE, ptr, len)
 
#define LOG_INFO(...)
 
#define LOG_INFO_LEN(...)
 
#define LOG_TIMING(...)
 
#define LOG_TRACE(...)
 
#define LOG_TRACE_ENTER()   LOG_TRACE(">> %s()\n", __FUNCTION__)
 
#define LOG_TRACE_ENTER_ARGS(x,...)   LOG_TRACE(">> %s(" x ")\n", __FUNCTION__, __VA_ARGS__)
 
#define LOG_TRACE_EXIT()   LOG_TRACE("<< %s()\n", __FUNCTION__)
 
#define LOG_TRACE_EXIT_RETURN(x,...)   LOG_TRACE("<< %s() = " x "\n", __FUNCTION__, __VA_ARGS__)
 
#define LOG_TRACE_LEN(ptr, len)
 
#define LOG_WARNING(...)
 
#define LOG_WARNING_LEN(...)
 
#define SERVAL_ENABLE_NETWORK_LOG   0
 
#define SERVAL_LOG_HEADER_LENGTH   19
 
#define SERVAL_LOG_LEVEL_DEBUG   5
 
#define SERVAL_LOG_LEVEL_ERROR   2
 
#define SERVAL_LOG_LEVEL_FATAL   1
 
#define SERVAL_LOG_LEVEL_INFO   4
 
#define SERVAL_LOG_LEVEL_OFF   0
 
#define SERVAL_LOG_LEVEL_TRACE   6
 
#define SERVAL_LOG_LEVEL_WARN   3
 
#define SERVAL_LOG_MAX_LEN_MODULE_NAME   3
 
#define SERVAL_LOG_MAX_LEN_TEXT   300
 
#define SERVAL_LOG_MAX_LEN_TIMESTAMP   10
 
#define SERVAL_UDP_LOG_DIRECT_SEND   0
 

Typedefs

typedef struct LogAppender_S LogAppender_T
 
typedef int LogLevel_T
 

Functions

void Log_disable (LogAppender_T *appender_ptr)
 
void Log_enable (LogAppender_T *appender_ptr)
 
void Log_flog (LogLevel_T lvl, const char *module_name, const char *text_ptr,...)
 
retcode_t Log_initialize (void)
 
void Log_log (LogLevel_T lvl, const char *module_name, const char *text_ptr, int len)
 
retcode_t Log_setLogLevel (LogLevel_T lvl)
 

Macro Definition Documentation

#define LOG_DEBUG (   ...)
#define LOG_DEBUG_LEN (   ptr,
  len 
)
#define LOG_ERROR (   ...)    Log_flog(SERVAL_LOG_LEVEL_ERROR, LOG_MODULE, __VA_ARGS__)
#define LOG_ERROR_LEN (   ptr,
  len 
)    Log_log(SERVAL_LOG_LEVEL_ERROR, LOG_MODULE, ptr, len)
#define LOG_FATAL (   ...)    Log_flog(SERVAL_LOG_LEVEL_FATAL, LOG_MODULE, __VA_ARGS__)
#define LOG_FATAL_LEN (   ptr,
  len 
)    Log_log(SERVAL_LOG_LEVEL_FATAL, LOG_MODULE, ptr, len)
#define LOG_INFO (   ...)
#define LOG_INFO_LEN (   ...)
#define LOG_TIMING (   ...)
#define LOG_TRACE (   ...)
#define LOG_TRACE_ENTER ( )    LOG_TRACE(">> %s()\n", __FUNCTION__)
#define LOG_TRACE_ENTER_ARGS (   x,
  ... 
)    LOG_TRACE(">> %s(" x ")\n", __FUNCTION__, __VA_ARGS__)
#define LOG_TRACE_EXIT ( )    LOG_TRACE("<< %s()\n", __FUNCTION__)
#define LOG_TRACE_EXIT_RETURN (   x,
  ... 
)    LOG_TRACE("<< %s() = " x "\n", __FUNCTION__, __VA_ARGS__)
#define LOG_TRACE_LEN (   ptr,
  len 
)
#define LOG_WARNING (   ...)
#define LOG_WARNING_LEN (   ...)
#define SERVAL_ENABLE_NETWORK_LOG   0

If the logging level has been defined before, then we set it to SERVAL_LOG_LEVEL_INFO as a default logging level.

NOTE: Available logging levels are: TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF Enable ''SERVAL_ENABLE_NETWORK_LOG'' in order to enable the logging over UDP

#define SERVAL_LOG_HEADER_LENGTH   19

Total length of the log header

#define SERVAL_LOG_LEVEL_DEBUG   5

Logging level DEBUG: Detailed information on the flow through the system. Expect these to be written to logs only.

NOTE: Available logging levels are: TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF

#define SERVAL_LOG_LEVEL_ERROR   2

Logging level ERROR: Other runtime errors or unexpected conditions. Expect these to be immediately visible on a status console.

NOTE: Available logging levels are: TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF

#define SERVAL_LOG_LEVEL_FATAL   1

Logging level FATAL: Severe errors that cause premature termination. Expect these to be immediately visible on a status console.

NOTE: Available logging levels are: TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF

#define SERVAL_LOG_LEVEL_INFO   4

Logging level INFO: Interesting runtime events (startup/shutdown). Expect these to be immediately visible on a console, so be conservative and keep to a minimum.

NOTE: Available logging levels are: TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF

#define SERVAL_LOG_LEVEL_OFF   0

Logging level OFF: Disables logging completely.

NOTE: Available logging levels are: TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF

#define SERVAL_LOG_LEVEL_TRACE   6

Logging level TRACE: More detailed information. Expect these to be written to logs only.

NOTE: Available logging levels are: TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF

#define SERVAL_LOG_LEVEL_WARN   3

Logging level WARN: Use of deprecated APIs, poor use of API, 'almost' errors, other runtime situations that are undesirable or unexpected, but not necessarily "wrong". Expect these to be immediately visCoapMessaging_getMessageTokenCOAPible on a status console.

NOTE: Available logging levels are: TRACE > DEBUG > INFO > WARN > ERROR > FATAL > OFF

#define SERVAL_LOG_MAX_LEN_MODULE_NAME   3

allowed length of a module name

#define SERVAL_LOG_MAX_LEN_TEXT   300

maximum logtext length

#define SERVAL_LOG_MAX_LEN_TIMESTAMP   10

length of a log timestamp

#define SERVAL_UDP_LOG_DIRECT_SEND   0

Enable ''SERVAL_UDP_LOG_DIRECT_SEND'' in order to enable that each log message is sent directly via udp. Disabled means that several log messages are collected until 5% of ''SERVAL_MAX_SIZE_APP_PACKET'' is reached.

Typedef Documentation

typedef struct LogAppender_S LogAppender_T

This type defines the attributes of an log appender.

typedef int LogLevel_T

Function Documentation

void Log_disable ( LogAppender_T appender_ptr)

Disables the given appender for logging.

Parameters
[in]appender_ptrthe appender to disable. It must be a valid pointer.
void Log_enable ( LogAppender_T appender_ptr)

Enables the given appender for logging.

Parameters
[in]appender_ptrthe appender to enable. It must be a valid pointer.
void Log_flog ( LogLevel_T  lvl,
const char *  module_name,
const char *  text_ptr,
  ... 
)

This function is called to log a message.

Depending on the parameter lvl and configured log level, a message will be logged to all enabled appenders.

Parameters
[in]lvlValue of log level of message to be logged.
[in]module_nameName of module which requested the logging, this will be added to log header.
[in]text_ptrMessage to be logged
[in]...Additional information for creation of log message.
See also
loglevel_t
retcode_t Log_initialize ( void  )

Used to initialize logging. It sets the default logging level to the maximal allowed level, i.e., SERVAL_LOG_LEVEL.

Returns
RC_OK
RC_LOG_INIT_ERROR
void Log_log ( LogLevel_T  lvl,
const char *  module_name,
const char *  text_ptr,
int  len 
)

This function is called to log a message.

Depending on the parameter lvl and configured log level, a message will be logged to all enabled appenders.

Parameters
[in]lvlValue of log level of message to be logged.
[in]module_nameName of module which requested the logging, this will be added to log header.
[in]text_ptrMessage to be logged
[in]lenLength of message to be logged.
See also
loglevel_t
retcode_t Log_setLogLevel ( LogLevel_T  lvl)

Sets the log level. The following levels are supported: SERVAL_LOG_LEVEL_OFF
SERVAL_LOG_LEVEL_FATAL
SERVAL_LOG_LEVEL_ERROR
SERVAL_LOG_LEVEL_WARNING
SERVAL_LOG_LEVEL_INFO
SERVAL_LOG_LEVEL_DEBUG
SERVAL_LOG_LEVEL_TRACE

Parameters
[in]lvlLoglevel to set
Returns
RC_OK on success
RC_LOG_LEVEL_NOT_SUPPORTED Log level is higher than SERVAL_LOG_LEVEL, which indicates the maximal log level at build time.

All rights reserved. The use is subject to the XDK SDK EULA by Bosch Connected Devices and Solutions GmbH.
This documentation file has been automatically generated on Thu Mar 14 2019 19:12:45 by doxygen 1.8.8