Don't get me wrong I use a logging function often but the function is self contained and portable.
The part that bothers me is the public file number and the fact that the file is opened and closed somewhere else.