  We consider volume-preserving flows $(\Phi^f_t)_{t\in\mathbb{R}}$ on $S\times
\mathbb{R}$, where $S$ is a closed connected surface of genus $g\geq 2$ and
$(\Phi^f_t)_{t\in\mathbb{R}}$ has the form $\Phi^f_t(x,y)=(\phi_tx,y+\int_0^t
f(\phi_sx)ds)$, where $(\phi_t)_{t\in\mathbb{R}}$ is a locally Hamiltonian flow
of hyperbolic periodic type on $S$ and $f$ is a smooth real valued function on
$S$. We investigate ergodic properties of these infinite measure-preserving
flows and prove that if $f$ belongs to a space of finite codimension in
$\mathscr{C}^{2+\epsilon}(S)$, then the following dynamical dichotomy holds: if
there is a fixed point of $(\phi_t)_{t\in\mathbb{R}}$ on which $f$ does not
vanish, then $(\Phi^f_t)_{t\in\mathbb{R}}$ is ergodic, otherwise, if $f$
vanishes on all fixed points, it is reducible, i.e. isomorphic to the trivial
extension $(\Phi^0_t)_{t\in\mathbb{R}}$. The proof of this result exploits the
reduction of $(\Phi^f_t)_{t\in\mathbb{R}}$ to a skew product automorphism over
an interval exchange transformation of periodic type. If there is a fixed point
of $(\phi_t)_{t\in\mathbb{R}}$ on which $f$ does not vanish, the reduction
yields cocycles with symmetric logarithmic singularities, for which we prove
ergodicity.
