Use the \mathop
command, as in:
\newcommand{\diag}{\mathop{\mathrm{diag}}}
Subscripts and superscripts on \diag
will be placed as they
are on \lim
. If you want your subscripts and superscripts always
placed to the right, do:
\newcommand{\diag}{\mathop{\mathrm{diag}}\nolimits}
AMSLaTeX provides a command \DeclareMathOperator
(in its
amsopn package) that satisfies the requirement.
(It should be noted that "log-like" was reportedly a joke on Lamport's part; it is of course clear what was meant.)