Prints msg on the terminal and in the log file. Commands in msg that are defined with \newcommand or \renewcommand are replaced by their definitions before being printed.
LaTeX's usual rules for treating multiple spaces as a single space and ignoring spaces after a command name apply to msg. A \space command in msg causes a single space to be printed.
See also Terminal Input and Output