Although the other response isn't incorrect, it doesn't quite answer the posed question and instead gives the generalization of the Riemann Xi function $\Xi$ for $L$ functions. The $Z$ and $\theta$ functions are supposed to be a polar decomposition of the zeta function on the critical line.
This decomposition is of the form
$$\zeta\left(\frac{1}{2}+it\right)=Z(t)e^{-i\theta(t)}$$
satisfying the property that if $t\in\mathbb{R}$, then $Z(t),\theta(t)\in\mathbb{R}$.
The $Z$ function has the special property that if $t\in\mathbb{R}$, then $|\zeta\left(\frac{1}{2}+it\right)|=|Z(t)|$ which is not satisfied by the $\Xi$ function.
Now, your question wants the generalization of this $Z$ function to $L$ functions. So, we can start with the zeta function as an example for how to construct these.
Finding $Z$ and $\theta$ for $\zeta$
First, recall the definition of $\zeta$
$$\zeta(s)=\sum_{n=1}^{\infty}\frac{1}{n^s}$$
$\zeta$, $Z$, and $\theta$ are holomorphic whose restriction to the real numbers is real-valued. So, using properties of the complex conjugate, we have that
$$\overline{\zeta(s)}=\zeta(\overline{s})$$
$$\overline{Z(t)}=Z(\overline{t})$$
$$\overline{\theta(t)}=\theta(\overline{t})$$
Specifically letting $s=\frac{1}{2}+it$ for $t\in\mathbb{R}$,
$$Z(t)e^{i\theta(t)}=\overline{Z(t)}e^{i\overline{\theta(t)}}=\overline{Z(t)e^{-i\theta(t)}}=\overline{\zeta\left(\frac{1}{2}+it\right)}=\zeta\left(\overline{\frac{1}{2}+it}\right)=\zeta\left(\frac{1}{2}-it\right)$$
The major insight comes from the reflection formula
$$\pi^{-\frac{s}{2}}\Gamma\left(\frac{s}{2}\right)\zeta(s)=\pi^{\frac{s-1}{2}}\Gamma\left(\frac{1-s}{2}\right)\zeta(1-s)$$
Plugging in $s=\frac{1}{2}+it$ and rearranging, we get
$$\frac{\zeta\left(\frac{1}{2}+it\right)}{\zeta\left(\frac{1}{2}-it\right)}=\frac{\pi^{it}\Gamma\left(\frac{1-2it}{4}\right)}{\Gamma\left(\frac{1+2it}{4}\right)}$$
Now, using the representations of $\zeta\left(\frac{1}{2}+it\right)$ and $\zeta\left(\frac{1}{2}-it\right)$ in terms of $Z$ and $\theta$, the $Z$'s cancel each other out, and we have
$$\frac{\zeta\left(\frac{1}{2}+it\right)}{\zeta\left(\frac{1}{2}-it\right)}=\frac{Z(t)e^{-i\theta(t)}}{Z(t)e^{i\theta(t)}}=e^{-2i\theta(t)}$$
This gives $\theta(t)$ as
$$e^{-2i\theta(t)}=\frac{\pi^{it}\Gamma\left(\frac{1-2it}{4}\right)}{\Gamma\left(\frac{1+2it}{4}\right)}$$
$$\theta(t)=-\frac{i}{2}\left(\ln\Gamma\left(\frac{1+2it}{4}\right)-\ln\Gamma\left(\frac{1-2it}{4}\right)\right)-\frac{\ln(\pi)}{2}t$$
Using the identities $\arg(z)=\frac{\ln(z)-\ln(\overline{z})}{2i}$ and $\overline{\Gamma(z)}=\Gamma(\overline{z})$, we can rewrite this in the commonly seen form as
$$\theta(t)=\arg\Gamma\left(\frac{1+2it}{4}\right)-\frac{\ln(\pi)}{2}t$$
The $Z$ function is then just
$$Z(t)=\zeta\left(\frac{1}{2}+it\right)e^{i\theta(t)}$$
Finding $Z$ and $\theta$ for $L$ functions
We'll take an extremely similar route to create the $Z$ function. First, let $\chi$ be primitive character modulo $q$ for $q>1$. Then, let's define $Z(t,\chi)$ and $\theta(t, \chi)$ as
$$L\left(\frac{1}{2}+it,\chi\right)=Z(t,\chi)e^{-i\theta(t,\chi)}$$
satisfying the property that if $t\in\mathbb{R}$, then $Z(t,\chi),\theta(t,\chi)\in\mathbb{R}$.
Similar to $Z$ and $\theta$ for the $\zeta$ function, because they are holomorphic functions whose restriction to the real numbers is real-valued, we have
$$\overline{Z(t,\chi)}=Z(\overline{t},\chi)$$
$$\overline{\theta(t,\chi)}=\theta(\overline{t},\chi)$$
Recall the definition of $L$
$$L(s,\chi)=\sum_{n=1}^{\infty}\frac{\chi(n)}{n^s}$$
Now, using properties of the complex conjugate, observe that
$$\overline{L(s,\chi)}=\overline{\sum_{n=1}^{\infty}\frac{\chi(n)}{n^s}}=\sum_{n=1}^{\infty}\frac{\overline{\chi}(n)}{n^{\overline{s}}}=L(\overline{s},\overline{\chi})$$
Specifically letting $s=\frac{1}{2}+it$ for $t\in\mathbb{R}$,
$$Z(t,\chi)e^{i\theta(t,\chi)}=\overline{Z(t,\chi)}e^{i\overline{\theta(t,\chi)}}=\overline{Z(t,\chi)e^{-i\theta(t,\chi)}}=\overline{L\left(\frac{1}{2}+it,\chi\right)}=L\left(\overline{\frac{1}{2}+it},\overline{\chi}\right)=L\left(\frac{1}{2}-it,\overline{\chi}\right)$$
Again, the major insight comes from the reflection formula
$$\left(\frac{q}{\pi}\right)^{\frac{s+a}{2}}\Gamma\left(\frac{s+a}{2}\right)L(s,\chi)=\varepsilon(\chi)\left(\frac{q}{\pi}\right)^{\frac{1-s+a}{2}}\Gamma\left(\frac{1-s+a}{2}\right)L(1-s,\overline{\chi})$$
where $a=0$ if $\chi$ is even and $a=1$ if $\chi$ is odd, and $\varepsilon(\chi)=\frac{\tau(\chi)}{i^a\sqrt{q}}$ satisfies $|\varepsilon(\chi)|=1$.
Plugging in $s=\frac{1}{2}+it$ and rearranging, we get
$$\frac{L\left(\frac{1}{2}+it,\chi\right)}{L\left(\frac{1}{2}-it,\overline{\chi}\right)}=\frac{\varepsilon(\chi)\left(\frac{\pi}{q}\right)^{it}\Gamma\left(\frac{1+2a-2it}{4}\right)}{\Gamma\left(\frac{1+2a+2it}{4}\right)}$$
Now, like before, using the representations of $L\left(\frac{1}{2}+it,\chi\right)$ and $L\left(\frac{1}{2}-it,\overline{\chi}\right)$ in terms of $Z$ and $\theta$, the $Z$'s cancel each other out, and we have
$$\frac{L\left(\frac{1}{2}+it,\chi\right)}{L\left(\frac{1}{2}-it,\overline{\chi}\right)}=\frac{Z(t,\chi)e^{-i\theta(t,\chi)}}{Z(t,\chi)e^{i\theta(t,\chi)}}=e^{-2i\theta(t,\chi)}$$
This gives $\theta(t,\chi)$ as
$$e^{-2i\theta(t,\chi)}=\frac{\varepsilon(\chi)\left(\frac{\pi}{q}\right)^{it}\Gamma\left(\frac{1+2a-2it}{4}\right)}{\Gamma\left(\frac{1+2a+2it}{4}\right)}$$
$$\theta(t,\chi)=-\frac{i}{2}\left(\ln\Gamma\left(\frac{1+2a+2it}{4}\right)-\ln\Gamma\left(\frac{1+2a-2it}{4}\right)\right)-\frac{\ln(\pi)-\ln(q)}{2}t+\frac{i}{2}\ln(\varepsilon(\chi))$$
And like before, using the identities $\arg(z)=\frac{\ln(z)-\ln(\overline{z})}{2i}$ and $\overline{\Gamma(z)}=\Gamma(\overline{z})$, we can rewrite this as
$$\theta(t,\chi)=\arg\Gamma\left(\frac{1+2a+2it}{4}\right)-\frac{\ln(\pi)-\ln(q)}{2}t+\frac{i}{2}\ln(\varepsilon(\chi))$$
The corresponding $Z$ function is then just
$$Z(t,\chi)=L\left(\frac{1}{2}+it,\chi\right)e^{i\theta(t,\chi)}$$
Hopefully this helps.