Replace deprecated vsprintf with vsnprintf in log_internal()