Re: syslog with strings?
Re: syslog with strings?
- Subject: Re: syslog with strings?
- From: Ken Thomases <email@hidden>
- Date: Fri, 23 Mar 2012 23:09:48 -0500
On Mar 23, 2012, at 9:08 PM, Prime Coderama wrote:
> Trying to write out syslog entries containing strings but they don't register.
>
> E.g.
>
> // where person.name is an NSSTring
> syslog(LOG_NOTICE, "Some string %@", person.name);
The %@ format specifier is a Cocoa-ism. (Well, it's also understood by Core Foundation.) It is not one of the standard printf-style format specifiers. You can't expect any random C library routine to understand them and then interpret the passed-in argument as an object pointer and invoke -description on it.
Try:
syslog(LOG_NOTICE, "Some string %s", [person.name UTF8String]);
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden