You can use Moodle's debugging() function with debug display off which should send it to the error log. Or you could directly use PHP's error_log() function which should do the same thing.
See https://docs.moodle.org/32/en/Debugging for more info on Moodle debugging.