added log levels to internal logging function