\HeaderA{message}{Diagnostic Messages}{message}
\aliasA{.makeMessage}{message}{.makeMessage}
\aliasA{.packageStartupMessage}{message}{.packageStartupMessage}
\aliasA{packageStartupMessage}{message}{packageStartupMessage}
\aliasA{suppressMessages}{message}{suppressMessages}
\aliasA{suppressPackageStartupMessages}{message}{suppressPackageStartupMessages}
\keyword{programming}{message}
\begin{Description}\relax
Generate a diagnostic message from its arguments.
\end{Description}
\begin{Usage}
\begin{verbatim}
message(..., domain = NULL, appendLF = TRUE)
suppressMessages(expr)

packageStartupMessage(..., domain = NULL, appendLF = TRUE)
suppressPackageStartupMessages(expr)

.makeMessage(..., domain = NULL, appendLF = FALSE)
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{...}] zero or more objects which can be coerced to character
(and which are pasted together with no separator) or (for
\code{message} only) a single condition object.
\item[\code{domain}] see \code{\LinkA{gettext}{gettext}}.  If \code{NA}, messages will
not be translated.
\item[\code{appendLF}] logical: should messages given as a character string
have a newline appended?
\item[\code{expr}] expression to evaluate.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
\code{message} is used for generating \sQuote{simple} diagnostic
messages which are neither warnings nor errors, but nevertheless
represented as conditions.  Unlike warnings and errors, a final
newline is regarded as part of the message, and is optional.
The default handler sends the message to the
\code{\LinkA{stderr}{stderr}()} connection.

If a condition object is supplied  to \code{message} it should be
the only argument, and further arguments will be ignored, with a warning.

While the message is being processed, a \code{muffleMessage} restart
is available.

\code{suppressMessages} evaluates its expression in a context that
ignores all \sQuote{simple} diagnostic messages.

\code{packageStartupMessage} is a variant whose messages can be
suppressed separately by \code{suppressPackageStartupMessages}.  (They
are still messages, so can be suppressed by \code{suppressMessages}.)

\code{.makeMessage} is a utility used by \code{message}, \code{warning}
and \code{stop} to generate a text message from the \code{...}
arguments by possible translation (see \code{\LinkA{gettext}{gettext}}) and
concatenation (with no separator).
\end{Details}
\begin{SeeAlso}\relax
\code{\LinkA{warning}{warning}} and \code{\LinkA{stop}{stop}} for generating warnings
and errors; \code{\LinkA{conditions}{conditions}} for condition handling and
recovery.

\code{\LinkA{gettext}{gettext}} for the mechanisms for the automated translation
of text.
\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
message("ABC", "DEF")
suppressMessages(message("ABC"))

testit <- function() {
  message("testing package startup messages")
  packageStartupMessage("initializing ...", appendLF = FALSE)
  Sys.sleep(1)
  packageStartupMessage(" done")
}

testit()
suppressPackageStartupMessages(testit())
suppressMessages(testit())
\end{ExampleCode}
\end{Examples}

