Solution (source code)

= Solution

For $h(x,y)=\tfrac12\log(x^2+y^2)$ away from the origin,
$$
\nabla h=\frac{(x,y)}{x^2+y^2},\quad h_{xx}=\frac{y^2-x^2}{(x^2+y^2)^2},\quad h_{yy}=\frac{x^2-y^2}{(x^2+y^2)^2},\quad\Delta h=0.
$$
The <Itô formula> for <planar Brownian motion> therefore has no drift term before the radius reaches $r$. Since the initial logarithm is zero,
$$
\boxed{\log|B_{t\wedge S_r}|=\int_0^{t\wedge S_r}\frac{B_s^1\,dB_s^1+B_s^2\,dB_s^2}{|B_s|^2}.}
$$
The integrand's squared norm is $|B_s|^{-2}\leq r^{-2}$ on this stopped interval, so this is a square-integrable <martingale> on every finite horizon, in particular a <local martingale>. One may first stop in an outer annulus to apply the formula on a compact smooth domain and then remove that localization.