Harmonic function as a function of z

**The question**

For the following harmonic function , find a harmonic conjugate for u and express the analytic function f = u + iv : as a function of z alone.

**My attempt:**

I used Cauchy Riemann equations to find v, and ended up with:

(where C is a constant)

So the function is unless I'm mistaken.

How do I write this in terms of a function of 'z'? I recall my lecturer saying that we set y = 0, solve, then change 'x' to 'z' and this works. Is this OK? I get nervous when I apply something that 'just works' and I have no idea why. Is this a common procedure? Thanks.