In first-order logic, one has a way of constructing all sentences out of some logical symbols, as well as function and relation symbols pertaining to a special kind of signature one is in.
Now in the book of Mac Lane on category theory, there is a similar construction, where the atomic statements (instead of only being things like equality over a single structure) involve also things like the domain of an arrow, where there are both objects and arrows, for instance.
I would like to ask whether there is some widely used general construction that generalises both.
As Alex says in the comments, you can use two-sorted first order logic for this, with a sort for objects and a sort for morphisms.
But actually this is technically unnecessary, and (small) categories can be axiomatized in ordinary first-order logic using morphisms only. The signature involves a set $A$ (the set of all morphisms), two unary functions $s, t : A \to A$ sending a morphism $f : c \to d$ to the identity morphism of its source $\text{id}_c$ and its target $\text{id}_d$ respectively, and a ternary relation $\circ \subset A \times A \times A$ consisting of the tuples $(f, g, f \circ g)$ describing composition, subject to various axioms, e.g. that for every tuple $(f, g, f \circ g)$ we must have
$$s(f \circ g) = s(g), t(f \circ g) = t(f), t(g) = s(f).$$
Identity morphisms, or equivalently objects, can be identified as those morphisms satisfying $s(i) = t(i) = i$ and that's how we state the identity axioms for composition.
However, you might find this a little contrived. The two-sorted theory is the more natural and straightforward thing to do and readily generalizes to a definition of an internal category in a category with pullbacks (which are needed to describe composition).