## complex integral

$\int_{-\pi}^{\pi} \ln (a-e^{ix}) \ dx \ a > 0$

My first inclination was to let $z = e^{ix}$ to get

$\int_{C_{1}^{+}(0)} \ln (a-z) \frac{dz}{iz} = 2\pi i \ \text{Res} \Big[ \frac{ln (a-z)}{iz}, 0 \Big] = 2 \pi \ln a$

But that's only the solution for when $a \ge 1$.

Is issue that the log function is a multivalued function, and I didn't define a branch cut? Do I need to deform the contour somehow?