Author: rfm
Date: Wed Mar  4 07:07:09 2015
New Revision: 38377

URL: http://svn.gna.org/viewcvs/gnustep?rev=38377&view=rev
Log:
define DLog() and ALog() if not already defined

Modified:
    libs/base/trunk/ChangeLog
    libs/base/trunk/Headers/GNUstepBase/NSDebug+GNUstepBase.h

Modified: libs/base/trunk/ChangeLog
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/ChangeLog?rev=38377&r1=38376&r2=38377&view=diff
==============================================================================
--- libs/base/trunk/ChangeLog   (original)
+++ libs/base/trunk/ChangeLog   Wed Mar  4 07:07:09 2015
@@ -1,3 +1,8 @@
+2015-02-28  Richard Frith-Macdonald <[email protected]>
+
+       * Headers/GNUstepBase/NSDebug+GNUstepBase.h:
+       Define DLog() and ALog() as suggested by Amr Aboelela
+
 2015-02-28  Richard Frith-Macdonald <[email protected]>
 
        * configure.ac: Check for gettid availability

Modified: libs/base/trunk/Headers/GNUstepBase/NSDebug+GNUstepBase.h
URL: 
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Headers/GNUstepBase/NSDebug%2BGNUstepBase.h?rev=38377&r1=38376&r2=38377&view=diff
==============================================================================
--- libs/base/trunk/Headers/GNUstepBase/NSDebug+GNUstepBase.h   (original)
+++ libs/base/trunk/Headers/GNUstepBase/NSDebug+GNUstepBase.h   Wed Mar  4 
07:07:09 2015
@@ -301,6 +301,30 @@
 #define NSWarnMLog(format, args...)
 #endif
 
+/** The DLog macro is a less powerful but commonly used logging macro,
+ * defined here for convenience when porting code.  It will tell you
+ * the function name and line number but not the fle location.
+ * It performs unconditional logging but is only compiled in when the
+ * program is built with DEBUG defined.
+ */
+#if     !defined(DLog)
+#ifdef DEBUG
+#define DLog(fmt, ...) \
+NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
+#else
+#define DLog(...)
+#endif
+#endif
+
+/** The Alog macro is the same as the DLog macro, but is always compiled
+ * in to the code whether DEBUG is defined or not.
+ */
+#if     !defined(ALog)
+#define ALog(fmt, ...) \
+NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__)
+#endif
+
+
 #endif /* OS_API_VERSION */
 
 #if    defined(__cplusplus)


_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs

Reply via email to