Align loader to 32-bit boundary
[fw/stlink] / src / uglylogging.h
index fa34d460c61494155c9e9ceb846750e347d048df..df816caedcf7dbc89382c752ee706aff0c77870f 100644 (file)
@@ -1,4 +1,4 @@
-/* 
+/*
  * Ugly, low performance, configurable level, logging "framework"
  */
 
@@ -8,16 +8,23 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-    
-#define UDEBUG 90
-#define UINFO  50
-#define UWARN  30
-#define UERROR 20
-#define UFATAL 10
 
-    int ugly_init(int maximum_threshold);
-    int ugly_log(int level, const char *tag, const char *format, ...);
+enum ugly_loglevel {
+       UDEBUG = 90,
+       UINFO  = 50,
+       UWARN  = 30,
+       UERROR = 20,
+       UFATAL = 10
+};
 
+int ugly_init(int maximum_threshold);
+int ugly_log(int level, const char *tag, const char *format, ...);
+
+#define DLOG(format, args...)   ugly_log(UDEBUG, __FILE__, format, ## args)
+#define ILOG(format, args...)   ugly_log(UINFO, __FILE__, format, ## args)
+#define WLOG(format, args...)   ugly_log(UWARN, __FILE__, format, ## args)
+#define ELOG(format, args...)   ugly_log(UERROR, __FILE__, format, ## args)
+#define fatal(format, args...)  ugly_log(UFATAL, __FILE__, format, ## args)
 
 #ifdef __cplusplus
 }