Thank you for responding. I am trying to use os_log, but run into an issue. The fmt I am using is a string and not a string literal. So for example if I use os_log(OS_LOG_DEFAULT, "%d %d", parm[0], parm [1]); . Xcode is totally OK with that. However if I use the (const char *) fmt_buffer, Xcode complains (Array initializer must be an initializer list or string literal). For example, os_log(OS_LOG_DEFAULT, fmt_buffer, parm[0], parm[1]); Doc says that os_log should accept a constant string, but I can't get it to work.
Post
Replies
Boosts
Views
Activity
Thank you for replying. That would be the right answer if I was using os_log. However using IOLog with a format string that is a dynamic string, that's the rub. By doing some additional testing, I note the following using a code snippet.
(const char *)e->fmt
LOG_INFO("%s \n", e->fmt);] // prints
LOG_INFO("%{public}s \n", e->fmt); //prints the format string, like "port[%u] link up"
IOLog((const char *)(e->fmt),
be32_to_cpu(e->params[0]));
I use e->fmt for the format in IOLog, and because it is a dynamic string, the output from IOLog is .
Trying to figure out how to fix this. Any ideas out there?
Anyone have any idea on how to make this work? What am I missing?
Thanks