I'm studying model theory nowadays, and I understand how one-sorted (classical) signatures and structures work. However I am also interested in groupoids, which can not be described as a structure for a one-sorted signature.
Looking up online, I came to the notion of many-sorted signature: nLab, Wikipedia. According to nLab, these can be used to describe, for example, directed (multi-)graphs, which seems easy enough: Take sorts for edges and vertices, and source and range maps from edges to vertices.
However I can't see how can we describe a signature for categories in this language. We need all the ingredients for graphs (edges=arrow, vertices=objects), and at least one function symbol for composition, but since composition is only partially defined, I don't see how this can be done.
Partially defined operations can be represented in first-order logic by relation symbols instead of function symbols. (Actually, so can totally defined operations--you don't actually need function symbols at all, though they are convenient for many purposes.) For instance, instead of writing $\circ$ for a partially defined binary operation, you can define a ternary relation $C(a,b,c)$ which you think of as "$a\circ b=c$". You then just have to add extra axioms stating that there exists a $c$ such that $C(a,b,c)$ iff the codomain of $b$ is the domain of $a$, in which case there exists only one such $c$.
You can use the same trick to avoid needing multiple sorts as well, as long as you only have only finitely many sorts. Just add a unary relation for each sort, and then encode all your functions as partial functions which are only defined when the inputs have the correct sort. You also need to add axioms saying all your relations can only be true if their arguments have the sorts they're supposed to. Finally, you need to add an axiom saying that every element has exactly one sort (this part is why you need to have only finitely many sorts).