added log() method, used to log messages (replaces System.out.println() for error signaling)