On 20 Feb 2015, at 19:32, Amr Aboelela <[email protected]> wrote:
> 
> NSLogv(NSString* format, va_list args)
> 
> ...
> 
>             /*prefix = [NSString
> 
>                       stringWithFormat: @"%@ %@[%d] ",
> 
>                       [[NSCalendarDate calendarDate]
> 
>                        descriptionWithCalendarFormat: @"%Y-%m-%d 
> %H:%M:%S.%F"],
> 
>                       [[NSProcessInfo processInfo] processName],
> 
>                       pid];*/
> 
>             prefix = [NSString
> 
>                       stringWithFormat: @"%@ %@[%d-%x] ",
> 
>                       [[NSCalendarDate calendarDate] 
> descriptionWithCalendarFormat: @"%M:%S.%F"],
> 
>                       [[NSProcessInfo processInfo] processName],
> 
>                       pid, (unsigned int)pthread_self()];
> 
> ...
> 
> }
> 
> 
> Instead of printing today date and hour which is useless for a developer, 
> print the current thread id:  (unsigned int)pthread_self()

Well, the timestamp is highly useful for most people, but perhpas more 
importantly we try to be compatible with Apple's implementation.

However, there's a user default called GSLogThread (near the start of the base 
library documentation ... you can find it online at 
http://www.gnustep.org/resources/documentation/Developer/Base/Reference/index.html),
 which you can set to extend the normal log format with a thread ID.  This is 
quite useful for debugging multithreaded programs.

In addition, if you look at NSLog() in your local base library documentation, 
you will find a whole selection of things you can use to customise NSLog() 
behavior and also support various formas of debug logging.


_______________________________________________
Discuss-gnustep mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/discuss-gnustep

Reply via email to