Consider the function $f: \Bbb R^+ \to \Bbb R$ given by $f(x) = \log(x)$. Then $f$ is continuous. The domain of $f$ is $\Bbb R^+$ and the range of $f$ is $\Bbb R$.
We have the following fact: (proven here)
A function $g : X \to Y$ is continuous if and only if for every closed $W \subseteq Y$, its preimage $g^{-1}(W) \subseteq X$ is closed.
But $f$ is continuous, $\Bbb R$ is closed and its preimage $\Bbb R^+ = (0, +\infty)$ is open. This seems to be a contradiction. I assume I'm missing something obvious...what's going on here?