If you allow the use of indicator or characteristic functions, then the answer is yes. For your example, if you let $A = \\{x \in \mathbb{R}| x < 10^{30}\\}$, then $f(x) = x^2 \cdot \chi_{A}(x) + \log x \cdot \chi_{A^{C}}(x)$ where $\chi_A$ and $\chi_A^{C}$ are the characteristic functions of $A$ and $A$ complement, respectively.