Deriving the logarithm of negative numbers is this approach correct?
$$\log_a b = \frac{\ln b}{\ln a} \tag{1}$$
but from the famous formula $e^{i\pi} = -1$ we can extend the domain of the natural logarithm and have $i\pi = \ln (-1)$ therefore for all real and non-zero a we can have:
$$\ln(a) = \ln(|a|\frac{a}{|a|}) = \ln(|a|) + \ln(\frac{a}{|a|}) $$
for example for negative a we have:
$$\ln (a) = \ln(|a|) + i\pi$$
and with the formula (1) we can extend this to all real numbers of a and b that are non-zero and the base non-equal to 1.
And how can we extend this to quaternions?


$$\log_a b = \frac{\ln b}{\ln a} \tag{1}$$
but from the famous formula $$e^{i\pi} = -1$$ we have $$i\pi = \ln (-1)$$

Rather than using formula $(1),$ aren't you just applying $\ln$ on both sides then applying the formula $$\ln e^z=z\,?$$ Unfortunately, this formula is not generally applicable for complex $z;$  in fact, $$\ln (-1)=i\pi +i2k\pi.$$

therefore for all real and non-zero a we can have:
$$\ln(|a|\frac{a}{|a|}) = \ln(|a|) + \ln(\frac{a}{|a|}) $$

Unfortunately, the formula $$\ln z_1z_2=\ln z_1+\ln z_2$$ is also not generally applicable for complex $z.$

for example for negative a we have:
$$\ln (a) = \ln(|a|) + i\pi$$

In fact, by the general definition of $\log,$ for $a<0,$ $$\ln (a)=\ln(-a) + i\pi +i2k\pi.$$

OP's comment:

yes i did not pay attention to that. in fact since $\exp(iz)=\exp(i(z+2π))$ it can have infinitely values!

Actually, $\exp(z)$ typically denotes a single-valued function, while $e^z$ is either single-valued or multivalued depending on the context; in Euler's formula above, it is strongly conventional to read $e^{i\pi}$ as single-valued.
