$xy'-y=0$ when $x<0$ 
How to solve $xy'-y=0$ when $x<0$?

It seem to be a simple equation, but it is confusing when $x<0$ 
$$\frac{y'}{y}=\frac{1}{x}$$
Now to integrate the both sides must I assume that $y$ is positive then 
$$\ln y =- \ln(-x)+c$$so 
$$y(x)=e^{-\ln(-x)}$$ 
Am I right? what if the assumption on $y$ is false? 
This equation has a solution over all $\mathbb{R}$?
Thanks in advence
 A: $$\frac{y'}{y}=\frac1x$$ integrates as
$$\log |y|=\log |x|+c$$
then
$$y=\pm Cx.$$
As $C$ could have any sign, the $\pm$ is superfluous and
$$y=Cx.$$
But
as there is a singularity at $x=0$, you cannot cross this point and you must consider two independent pieces:
$$y(x):=\begin{cases}x\le0\to C_-x,\\x\ge0\to C_+x.\end{cases}$$ where the constants need not be equal.
At $x=0$, the equation reduces to $y=0$ and this is compatible with the above solution.
But if you insist that $y'$ exists at $x=0$, the constants must be equal.
A: It's not great to write $\frac{y'}{y}$ since you don't know $y$... It might be better to write :
$$ y' - \frac{1}{x}y = 0 $$ 
which is the Cauchy-Lipschitz form of a differential equation. You have to solve that equation on an interval where $a$ is defined, i.e. either $\mathbb R_+^*$ or $\mathbb R_-^*$. The equation is then equivalent to :
$$ \frac{d}{dx} y e^{-\text{ln(x)}} = 0 \Rightarrow y = 
Cx $$
More generally, if you have the following diffenrential equation :
$$ y + a(x) y = 0 $$ 
You can always say :
$$ \frac{d}{dx} ye^{\int_{t_0}^x a(t) dt} = 0 $$
and conclude. 
A: Without log function
$$y'x-y=0$$
for $x \ne 0$
$$\frac {(y'x-y)}{x^2}=0$$
$$\left(\frac yx \right)'=0$$
Integrate
$$\frac yx= K$$
$$y(x)=Kx$$
A: You do not presume $y$ to be positive or negative. Rather,  $$\frac{y'}{y}=\frac{1}{x} \implies \ln(\color{red}{|y|}) = \ln(-x) + c \implies |y| = e^{\ln(-x)+c} \implies  y(x) = C x,$$
where $C$ can be positive or negative.
Also, the above result holds for all values of $x$, positive or negative. To verify, observe that $$y' = C \implies x y' - y = 0.$$
