A $2$-torus is a topological space $X$ that is homeomorphic (one-one continuously equivalent) to the surface $S$ of a doughnut in three-space. For all practical purposes we may require that $X$ is diffeomorphic (one-one differentiably equivalent) to $S$.
A Riemannian metric on $X$ is a law that allows to measure the length of (continuously differentiable) curves on $X$. This law is expressed "in local coordinates" $(u_1,u_2)$ by means of a quadratic expression $ds^2=\sum_{i,k} g_{ik} du_i du_k$. For a curve $\gamma:\ t\mapsto u(t)$ $\ (a\leq t\leq b)$ its length is then given by $L(\gamma)=\int_a^b\sqrt{\sum_{i,k} g_{ik} \dot u_i \dot u_k}\ dt$. When $X=S$ with the metric "inherited from" ${\mathbb R}^3$ then the formulae from treble's answer apply.
There is a very deep theorem about Rienmannian $2$-tori in general. It says the following: If $X$ is a Riemannian $2$-torus then there is a lattice $\Lambda$ in ${\mathbb R}^2$ (with fundamental parallelogram $P$) and a function $\rho:{\mathbb R}^2\to{\mathbb R}_{>0}$, periodic with respect to $\Lambda$, such that $X$ can be regarded as ${\mathbb R}^2/\Lambda$ ("$P$ with parallel edges identified"), provided with the Riemannian metric $ds=\rho(z)|dz|$, where$|dz|:=\sqrt{|dx^2+dy^2}$.
If the function $g$ is actually a constant then we say that the metric on $X$ is "locally euclidean". But note that the global metric structure of $X$ depends also on the shape of $\Lambda$, so there is an infinity of different "locally euclidean" $2$-tori.
In the case of a "real" doughnut embedded in $3$-space the corresponding lattice $\Lambda$ is orthogonal, and the function $g$ is $\Lambda$-periodic, but not constant.