Useful program logging. Add info about grep-mode and logging format.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Wed, 19 Jan 2011 11:56:48 +0200
changeset 777 e759f98ea3a8
parent 776 48b1ac6283ec
child 778 67a292e6d70b
Useful program logging. Add info about grep-mode and logging format.
emacs.rst
--- a/emacs.rst	Wed Jan 19 00:50:45 2011 +0200
+++ b/emacs.rst	Wed Jan 19 11:56:48 2011 +0200
@@ -299,7 +299,8 @@
 
 * Useful program logging.
 
-Put first line to your log file, you must replace default-directory to dir where you build program:
+Put first line to your log file, you must replace 'default-directory' to dir where you build
+program:
 
   -*- mode: compilation-minor; mode: auto-revert-tail; default-directory: "~/devel/proj" -*-
 
@@ -308,3 +309,15 @@
 
   printf(__FILE__ ":%d: %s\n", __LINE__, msg);  /* msg - user defined string */
 
+or in second form (in this case line number included in format string, so easy searchable in
+debugger):
+
+  #define NUM2STR(x) STR(x)
+  #define STR(x) #x
+
+  printf(__FILE__ ":" NUM2STR(__LINE__) ": %s\n", msg);
+
+Or some faster use 'grep-mode', but you restricted with GNU like error format:
+
+  -*- mode: grep; mode: auto-revert-tail; default-directory: "~/devel/proj" -*-
+