I've always been taught that when integrating a function of the form f'(x)/f(x) to put an absolute value around the argument of the resulting logarithm. For example:
$\int\frac1{x}\mathrm dx = \log{|x|} + c$
The reason provided was that 'logarithms aren't defined for negative numbers', it seems a bit like cheating to me to just throw absolute values around the argument. Furthermore, I thought of a case where this would actually produce the wrong result;
$\int_{-1}^1\frac1{x}\mathrm dx = \log|1| - \log|-1| = 0$
However, the correct way should be this:
$\int_{-1}^1\frac1{x}\mathrm dx = \log(1) - \log(-1) = 0 - i\pi = -i\pi$
Edit: I may be wrong, but the integral above, ignoring the singularity (sorry couldn't think of a better example to illustrate my point with -1 and changing it now would make people's answers and comments seem off-topic), should be correct due to Euler's identity:
$e^{i\pi} = -1 \implies \log(-1) = i\pi$
Could someone please provide a better explanation?
Thanks