Replace log.warn() with warnings.warn()