366 #ifndef LEGATO_LOG_INCLUDE_GUARD 367 #define LEGATO_LOG_INCLUDE_GUARD 374 typedef enum _le_log_Level_t
396 #if LE_CONFIG_LOG_STATIC_FILTER_NO_LOG 397 # define LE_LOG_LEVEL_STATIC_FILTER LE_LOG_MAX 398 #elif LE_CONFIG_LOG_STATIC_FILTER_EMERG 399 # define LE_LOG_LEVEL_STATIC_FILTER LE_LOG_EMERG 400 #elif LE_CONFIG_LOG_STATIC_FILTER_CRIT 401 # define LE_LOG_LEVEL_STATIC_FILTER LE_LOG_CRIT 402 #elif LE_CONFIG_LOG_STATIC_FILTER_ERR 403 # define LE_LOG_LEVEL_STATIC_FILTER LE_LOG_ERR 404 #elif LE_CONFIG_LOG_STATIC_FILTER_WARN 405 # define LE_LOG_LEVEL_STATIC_FILTER LE_LOG_WARN 406 #elif LE_CONFIG_LOG_STATIC_FILTER_INFO 407 # define LE_LOG_LEVEL_STATIC_FILTER LE_LOG_INFO 409 # define LE_LOG_LEVEL_STATIC_FILTER LE_LOG_DEBUG 415 typedef struct le_log_Session* le_log_SessionRef_t;
417 typedef struct le_log_Trace* le_log_TraceRef_t;
419 #if !defined(LE_DEBUG) && \ 420 !defined(LE_DUMP) && \ 421 !defined(LE_LOG_DUMP) && \ 422 !defined(LE_INFO) && \ 423 !defined(LE_WARN) && \ 424 !defined(LE_ERROR) && \ 425 !defined(LE_CRIT) && \ 429 # define LE_LOG_DEFAULT_IMPL 1 439 const le_log_TraceRef_t traceRef,
440 le_log_SessionRef_t logSession,
441 const char *filenamePtr,
442 const char *functionNamePtr,
443 const unsigned int lineNumber,
444 const char *formatPtr,
456 const uint8_t *dataPtr,
458 const
char *filenamePtr,
459 const
char *functionNamePtr,
461 const
unsigned int lineNumber
472 le_log_TraceRef_t _le_log_GetTraceRef
474 le_log_SessionRef_t logSession,
483 void _le_log_SetFilterLevel
485 le_log_SessionRef_t logSession,
497 extern
LE_SHARED le_log_SessionRef_t LE_LOG_SESSION;
514 #if LE_CONFIG_LOG_FUNCTION_NAMES 515 # define _LE_LOG_FUNCTION_NAME __func__ 517 # define _LE_LOG_FUNCTION_NAME NULL 528 #define _LE_LOG_MSG(level, formatString, ...) \ 530 if ((level >= LE_LOG_LEVEL_STATIC_FILTER) && \ 531 ((LE_LOG_LEVEL_FILTER_PTR == NULL) || (level >= *LE_LOG_LEVEL_FILTER_PTR))) \ 532 _le_log_Send(level, NULL, LE_LOG_SESSION, __FILE__, _LE_LOG_FUNCTION_NAME, __LINE__, \ 533 formatString, ##__VA_ARGS__); \ 547 #define LE_DEBUG(formatString, ...) _LE_LOG_MSG(LE_LOG_DEBUG, formatString, ##__VA_ARGS__) 557 #define LE_DUMP(dataPtr, dataLength) \ 558 _le_LogData(LE_LOG_DEBUG, dataPtr, dataLength, STRINGIZE(LE_FILENAME), _LE_LOG_FUNCTION_NAME, \ 570 #define LE_LOG_DUMP(level, dataPtr, dataLength) \ 571 _le_LogData(level, dataPtr, dataLength, STRINGIZE(LE_FILENAME), _LE_LOG_FUNCTION_NAME, __LINE__) 573 #define LE_INFO(formatString, ...) _LE_LOG_MSG(LE_LOG_INFO, formatString, ##__VA_ARGS__) 575 #define LE_WARN(formatString, ...) _LE_LOG_MSG(LE_LOG_WARN, formatString, ##__VA_ARGS__) 577 #define LE_ERROR(formatString, ...) _LE_LOG_MSG(LE_LOG_ERR, formatString, ##__VA_ARGS__) 579 #define LE_CRIT(formatString, ...) _LE_LOG_MSG(LE_LOG_CRIT, formatString, ##__VA_ARGS__) 581 #define LE_EMERG(formatString, ...) _LE_LOG_MSG(LE_LOG_EMERG, formatString, ##__VA_ARGS__) 589 #define LE_LOG_CAN_TRACE 1 601 #define LE_IS_TRACE_ENABLED(traceRef) (le_log_IsTraceEnabled(traceRef)) 609 #define LE_TRACE(traceRef, string, ...) \ 610 if (le_log_IsTraceEnabled(traceRef)) \ 612 _le_log_Send((le_log_Level_t)-1, \ 615 STRINGIZE(LE_FILENAME), \ 616 _LE_LOG_FUNCTION_NAME, \ 632 #define le_log_GetTraceRef(keywordPtr) \ 633 _le_log_GetTraceRef(LE_LOG_SESSION, (keywordPtr)) 645 #define le_log_IsTraceEnabled(traceRef) ((traceRef) == NULL ? false : *((bool *) (traceRef))) 659 #define le_log_SetFilterLevel(level) \ 660 _le_log_SetFilterLevel(LE_LOG_SESSION, (level)) 668 #define le_log_GetFilterLevel() \ 669 ((LE_LOG_LEVEL_FILTER_PTR != NULL)?(*LE_LOG_LEVEL_FILTER_PTR):(LE_LOG_INFO)) 683 #define le_log_EnableTrace(traceRef) \ 684 ((void)(*((bool*)(traceRef)) = true)) 698 #define le_log_DisableTrace(traceRef) \ 699 ((void)(*((bool*)(traceRef)) = false)) 704 #if !defined(LE_DEBUG) 705 # error "Logging are overridden, but LE_DEBUG not defined. Define LE_DEBUG." 708 #if !defined(LE_DUMP) 709 # error "Logging are overridden, but LE_DUMP not defined. Define LE_DUMP." 712 #if !defined(LE_LOG_DUMP) 713 # error "Logging are overridden, but LE_LOG_DUMP not defined. Define LE_LOG_DUMP." 716 #if !defined(LE_INFO) 717 # error "Logging are overridden, but LE_INFO not defined. Define LE_INFO." 720 #if !defined(LE_WARN) 721 # error "Logging are overridden, but LE_WARN not defined. Define LE_WARN." 724 #if !defined(LE_ERROR) 725 # error "Logging are overridden, but LE_ERROR not defined. Define LE_ERROR." 728 #if !defined(LE_CRIT) 729 # error "Logging are overridden, but LE_CRIT not defined. Define LE_CRIT." 732 #if !defined(LE_EMERG) 733 # error "Logging are overridden, but LE_EMERG not defined. Define LE_EMERG." 738 #ifndef le_log_SetFilterLevel 750 #define le_log_SetFilterLevel(level) ((void)(level)) 757 #ifndef le_log_GetFilterLevel 763 #define le_log_GetFilterLevel() (LE_LOG_LEVEL_STATIC_FILTER) 782 #define LE_IS_TRACE_ENABLED(traceRef) (false) 790 #define LE_TRACE(traceRef, string, ...) ((void)(traceRef)) 802 #define le_log_GetTraceRef(keywordPtr) ((le_log_TraceRef_t)NULL) 814 #define le_log_IsTraceEnabled(traceRef) (false) 828 #define le_log_EnableTrace(traceRef) ((void)(0)) 842 #define le_log_DisableTrace(traceRef) ((void)(0)) 860 void _le_log_ExitFatal
877 #define LE_DEBUG_IF(condition, formatString, ...) \ 878 if (condition) { LE_DEBUG(formatString, ##__VA_ARGS__); } 880 #define LE_INFO_IF(condition, formatString, ...) \ 881 if (condition) { LE_INFO(formatString, ##__VA_ARGS__); } 883 #define LE_WARN_IF(condition, formatString, ...) \ 884 if (condition) { LE_WARN(formatString, ##__VA_ARGS__); } 886 #define LE_ERROR_IF(condition, formatString, ...) \ 887 if (condition) { LE_ERROR(formatString, ##__VA_ARGS__); } 889 #define LE_CRIT_IF(condition, formatString, ...) \ 890 if (condition) { LE_CRIT(formatString, ##__VA_ARGS__); } 892 #define LE_EMERG_IF(condition, formatString, ...) \ 893 if (condition) { LE_EMERG(formatString, ##__VA_ARGS__); } 906 # if !LE_CONFIG_DEBUG 907 # define LE_FATAL(formatString, ...) \ 908 { LE_EMERG(formatString, ##__VA_ARGS__); _le_log_ExitFatal(); } 910 # define LE_FATAL(formatString, ...) \ 911 { LE_EMERG(formatString, ##__VA_ARGS__); abort(); } 925 #define LE_FATAL_IF(condition, formatString, ...) \ 926 if (condition) { LE_FATAL(formatString, ##__VA_ARGS__) } 935 #define LE_ASSERT(condition) \ 936 LE_FATAL_IF(!(condition), "Assert Failed: '%s'", #condition) 945 #define LE_ASSERT_OK(condition) \ 946 LE_FATAL_IF((condition) != LE_OK, "Assert Failed: '%s' is not LE_OK (0)", #condition) 961 #define LE_RESULT_TXT(v) _le_log_GetResultCodeString(v) 974 # define LE_ERRNO_TXT(v) _le_log_GetErrnoCodeString(v) 975 # define LE_LOG_NEED_GET_ERRNO_STRING 1 1005 const char *componentNamePtr,
1009 #endif // LEGATO_LOG_INCLUDE_GUARD le_log_Level_t
Definition: le_log.h:374
const char * _le_log_GetErrnoCodeString(int errnoCode)
Function that does the real work of translating result codes. See LE_RESULT_TXT.
Emergency. A fatal error has occurred. A process is being terminated.
Definition: le_log.h:383
One beyond maximum log level.
Definition: le_log.h:384
LE_FULL_API le_log_SessionRef_t le_log_RegComponent(const char *componentNamePtr, le_log_Level_t **levelFilterPtrPtr)
LE_FULL_API void le_log_ConnectToControlDaemon(void)
const char * _le_log_GetResultCodeString(le_result_t resultCode)
Function that does the real work of translating result codes. See LE_RESULT_TXT.
__attribute__((noreturn)) void _le_log_ExitFatal(void)
Function that exits in a race-free manner – work around glibc BZ#14333.
le_result_t
Definition: le_basics.h:45
Informational message. Normally expected.
Definition: le_log.h:377
Warning. Possibly indicates a problem. Should be addressed.
Definition: le_log.h:378
#define LE_FULL_API
Definition: le_apiFeatures.h:42
Debug message.
Definition: le_log.h:376
#define LE_SHARED
Definition: le_basics.h:297