-1

Below is a typical NSLog output from the console. Can I get rid of the bold text?

2013-06-09 22:17:02.351 ProjectName[33584:907] MyWantedText

I want to cut out the console text, and compare it (by diff), to a similar log. I don't want time data etc that only will produce false positives.

Is it possible to make my own console write method, MyNsLog, if I can't alter de behavior NSLog?

Undo
  • 25,519
  • 37
  • 106
  • 129
Fredrik Johansson
  • 1,301
  • 1
  • 13
  • 26

3 Answers3

2

for your app put this into your Prefix header:

#undef NSLog
#define NSLog(fmt, ...) printf("%s", [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String])

but id actually rather leave nslog and just use another logging mechanism like ddlog or so

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
0

Simple,

NSString *text = @"Some text here";

printf("%s", [text UTF8String]);

Result,

Some text here
OutOfBoundsException
  • 756
  • 1
  • 11
  • 26
0

You can't rid of the bold text, NSLog() adds the capability to print out objects variables. Also as you can see, adds the program name, the date, the time.

You can change for another logging function like printf

rhalgravez
  • 366
  • 2
  • 9