does os_log make the public identifier everywhere in codes

i have some questions about os_log

1. does os_log cause a log of changes to the code that print log with NSlog? Since we can not simply replace NSlog with os_log。

2. does the os_log make the "public" identifier everywhere in codes?

Replies

I’m sorry but I don’t understand either of your questions. Let’s see if we can clarify things…

1. does

os_log
cause a log of changes to the code that print log with
NSLog
?

Are you asking whether you have to change the code that does the logging?

If so, the answer is yes.

os_log
is not meant to be a drop-in replacement for
NSLog
, and you should not treat it as such.
os_log
has a lot of very cool features, and if you simply replace
NSLog
calls with
os_log
you will be missing out. Rather, you should take this opportunity to carefully reconsider your overall logging strategy.

2. does the os_log make the "public" identifier everywhere in codes?

I can’t even guess what you mean here. Please elaborate.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

thanks for your reply.

let me explain the question.

1. does

os_log
cause a log of changes to the code that print log with
NSLog
?

what i want to consult is that whether the NSlog can still work after we have os_log?

2. does the os_log make the "public" identifier everywhere in codes?

With os_log, we need to add the {public} identifier in order to display non-private variables since os_log will display many variables that are not identified as {public} as <private>。 whether this lead to the need to add {public} to print logs in many scenarios since privacy is a small part in logs. if so, this will result in a lot of "{public}" identifiers in the code.

what i want to consult is that whether the

NSLog
can still work after we have
os_log
?

Yes.

NSLog
and
os_log
both create log entries in the system log, with the difference being that
os_log
is more efficient and gives you a lot more control over how those log entries are structured.

if so, this will result in a lot of "{public}" identifiers in the code.

Possibly, but it really depends on what you’re logging. The whole point of the private/public distinction is to draw your attention to the potentially sensitive nature of log entries. If you go to the trouble of switching to

os_log
, you should use that opportunity to audit the public information to confirm whether it really should be public.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

i got it.

thanks for reply