OSL Debugging with fprintf
The OSL documentation states the fprintf function for already a long time. but the actual commit has been done last summer. The OSL version blender is using (1.7.5) does not have the code for fprintf. The fprintf function is supposed to be released in OSL version 1.9.1 1 

It is unclear when blender will update their current OSL version to this version. Developers of Blender are still planning on this subject, and I have found several commits to support OSL 1.9 in cycles.