Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
log.h
00001 #ifndef __DEBUG_H__ 00002 #define __DEBUG_H__ 00003 00004 #include "mbed.h" 00005 00006 #define LOG_OUTPUT_ERROR (1) 00007 #define LOG_OUTPUT_WARN (1) 00008 #define LOG_OUTPUT_INFO (1) 00009 #define LOG_OUTPUT_DEBUG (1) 00010 #define LOG_OUTPUT_VERBOSE (1) 00011 00012 #define LOG_OUTPUT_ERROR_PREFIX (1) 00013 #define LOG_OUTPUT_WARN_PREFIX (1) 00014 #define LOG_OUTPUT_INFO_PREFIX (0) 00015 #define LOG_OUTPUT_DEBUG_PREFIX (0) 00016 #define LOG_OUTPUT_VERBOSE_PREFIX (0) 00017 00018 extern Serial pc; 00019 00020 #define log_out pc.printf 00021 00022 #define logError(fmt, args...)\ 00023 do {\ 00024 if (LOG_OUTPUT_ERROR)\ 00025 {\ 00026 if(LOG_OUTPUT_ERROR_PREFIX)\ 00027 log_out("[LOG Error:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\ 00028 log_out(fmt, ##args);\ 00029 log_out("\r\n");\ 00030 }\ 00031 } while(0) 00032 00033 #define logWarn(fmt, args...)\ 00034 do {\ 00035 if (LOG_OUTPUT_WARN)\ 00036 {\ 00037 if(LOG_OUTPUT_WARN_PREFIX)\ 00038 log_out("[LOG Warn:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\ 00039 log_out(fmt, ##args);\ 00040 log_out("\r\n");\ 00041 }\ 00042 } while(0) 00043 00044 #define logDebug(fmt, args...)\ 00045 do {\ 00046 if (LOG_OUTPUT_DEBUG)\ 00047 {\ 00048 if (LOG_OUTPUT_DEBUG_PREFIX)\ 00049 log_out("[LOG Debug:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\ 00050 log_out(fmt, ##args);\ 00051 log_out("\r\n");\ 00052 }\ 00053 } while(0) 00054 00055 #define logInfo(fmt, args...)\ 00056 do {\ 00057 if (LOG_OUTPUT_INFO)\ 00058 {\ 00059 if (LOG_OUTPUT_INFO_PREFIX)\ 00060 log_out("[LOG Info:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\ 00061 log_out(fmt, ##args);\ 00062 log_out("\r\n");\ 00063 }\ 00064 } while(0) 00065 00066 00067 #define logVerbose(fmt, args...)\ 00068 do {\ 00069 if (LOG_OUTPUT_VERBOSE)\ 00070 {\ 00071 if (LOG_OUTPUT_VERBOSE_PREFIX)\ 00072 log_out("[LOG Verbose:%s,%d,%s] ",__FILE__,__LINE__,__FUNCTION__);\ 00073 log_out(fmt, ##args);\ 00074 log_out("\r\n");\ 00075 }\ 00076 } while(0) 00077 00078 00079 #endif /* #ifndef __DEBUG_H__ */
Generated on Tue Jul 12 2022 18:59:49 by
1.7.2