Here is how I think about this question.
Let $h = f-g$, and we know that h is analytic. Therefore $\left|e^ {f-g} \right| = e^ {Reh} = e^0 = 1$, since $Ref = Reg$
So $\left|e^ {f-g} \right| = 1 $ and it implies that $e^ {f-g}$ is constant which means $e^ {f-g} = c$ so $f-g = ln(c)$