Fixed compiler warnings.
Replaced more fprintf / printf with logging macros.