How to write the Nernst Equation for this reaction?

I am required to write the Nernst equation for the following reaction:

$$\ce{O_2 + 4H^+ + 4e^- -> 2H_2O}$$

Clearly, here $$\ce{O_2}$$ is getting reduced from an oxidation number of zero to an oxidation number of $$\mathrm{-2}$$ in the water molecule.

Usually, the examples of chemical reactions provided in the textbooks(at least in high school textbooks) for writing Nernst equations are of the form: $$\ce{M^{n+}(aq) + ne^- -> M(s)}$$ and the Nernst equation for this electrode reaction is given as: $$E_\ce{(M^{n+}/M)} = E^\circ _\ce{(M^{n+}/M)} - \frac{RT}{nF}\mathrm{ln}\frac{1}{[\ce{M^{n+}}]}$$

But here, in this case, the oxidation state for the $$\ce{H^+}$$ remains the same on both side of the reaction, rather the oxygen gas gets reduced. And this is what is confusing me.

The solution provided states that the equation should be: $$E = E^\circ+\frac{0.059}{4}\mathrm{log}[\ce{H^+}]^4 \cdot P_\ce{O_2}$$

I specifically didn't understand the reasoning behind writing the part that comes after log.