  We consider smooth area-preserving flows (also known as locally Hamiltonian
flows) on surfaces of genus $g\geq 1$ and study ergodic integrals of smooth
observables along the flow trajectories. We show that these integrals display a
\emph{power deviation spectrum} and describe the cocycles that lead the pure
power behaviour, giving a new proof of results by Forni (Annals 2002) and
Bufetov (Annals 2014) and generalizing them to observables which are non-zero
at fixed points. This in particular completes the proof of the original
formulation of the Kontsevitch-Zorich conjecture. Our proof is based on
building suitable \emph{correction operators} for cocycles with logarithmic
singularities over a full measure set of interval exchange transformations
(IETs), in the spirit of Marmi-Moussa-Yoccoz work on piecewise smooth cocycles
over IETs. In the case of symmetric singularities, exploiting former work of
the second author (Annals 2011), we prove a tightness result for a finite
codimension class of observables. We then apply the latter result to prove the
existence of ergodic infinite extensions for a full measure set of locally
Hamiltonian flows with non-degenerate saddles in any genus $g\geq 2$.
