Hi guys,

I've prepared a patch to SER logging framework that _automatically_ 
prefix log messages with the log level and module name strings.  In 
short, you no longer need to explicitly include the log level or module 
name string in the message.

Eg.:
   Instead of:
      LOG(L_ERR, "tm: ERROR: something failed\n");
   you will write:
      ERR("something failed\n");

The new stderr/syslog format is:

   LEVEL: MODULE [FILE:LINE]: MESSAGE
   LEVEL: MODULE: MESSAGE  ... if NO_DEBUG macro is defined

MODULE is "<core>" for the core and "<script>" for the ser.cfg generated 
log messages.

Another feature is that LOG(L_...) macro is superseded by the 
corresponding ERR/DBG/...() shorter equivalents (of course, it's still 
used when the first argument isn't constant).

The main reason was to unify the log messages and enable their further 
processing by text tools (filtering, colorification, you-name-it,...).

Since many log messages need to be updated I created a perl script that 
fixes most of them in one shot:
  - any log level and module name prefix is removed
  - LOG(L_ERR/DBG/etc., ...) is replaced by shorter ERR/DBG/etc.() macros
  - fix the messages where the log level and the prefix mismatch:

  Eg.: ERR vs. BUG
       LOG(L_ERR, "BUG: tm: foo\n")
    becomes:
       BUG("foo\n");


Note that because of this script the patch will touch a lot of files in 
many modules.  Please feel free to ask about details, suggest or object 
to the changes.  I plan to commit it soon if there will be no serious 
objections.

Regards
--ondra

_______________________________________________
Serdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/serdev

Reply via email to