3

I use universal logging and this has been bugging me for a while. Many developers I know as well as and various blogs all tell me to import os.log.

However I think that's wrong because:

  • Apple's recommendation on imports is to import the top level module only. ie. import os.
  • When I look at the headers all the functions and types are in the os header and the os.log header only contains a few lower level types. Not the full framework.

So why does import os.log even work? I'm not an expert on this but I think due to the way imports work in C import os.log is effectively pulling in the os header and in turn all the other headers it imports. Thereby making the full framework available.

Some developers have told me that I should import os.log because `os' is not clear enough and some have even told me it contains other "Operating System" things. But I've found not evidence of that.

So, the question is - any I right in only using import os? Or is there some other reason to import os.log I've not found?

drekka
  • 20,957
  • 14
  • 79
  • 135

0 Answers0