added console detection for logging