% Generated by roxygen2: do not edit by hand % Please edit documentation in R/Appender.R \name{AppenderConsole} \alias{AppenderConsole} \title{Log to the console} \description{ An Appender that outputs to the \R console. If you have the package \strong{crayon} installed log levels will be coloured by default (but you can modify this behaviour by passing a custom \link{Layout}). } \examples{ # create a new logger with propagate = FALSE to prevent routing to the root # logger. Please look at the section "Logger Hirarchies" in the package # vignette for more info. lg <- get_logger("test")$set_propagate(FALSE) lg$add_appender(AppenderConsole$new()) lg$add_appender(AppenderConsole$new( layout = LayoutFormat$new("[\%t] \%c(): [\%n] \%m", colors = getOption("lgr.colors")))) # Will output the message twice because we attached two console appenders lg$warn("A test message") lg$config(NULL) # reset config } \seealso{ \link{LayoutFormat} Other Appenders: \code{\link{Appender}}, \code{\link{AppenderBuffer}}, \code{\link{AppenderFile}}, \code{\link{AppenderFileRotating}}, \code{\link{AppenderFileRotatingDate}}, \code{\link{AppenderFileRotatingTime}}, \code{\link{AppenderTable}} } \concept{Appenders} \section{Super classes}{ \code{\link[lgr:Filterable]{lgr::Filterable}} -> \code{\link[lgr:Appender]{lgr::Appender}} -> \code{AppenderConsole} } \section{Methods}{ \subsection{Public methods}{ \itemize{ \item \href{#method-AppenderConsole-new}{\code{AppenderConsole$new()}} \item \href{#method-AppenderConsole-append}{\code{AppenderConsole$append()}} \item \href{#method-AppenderConsole-set_connection}{\code{AppenderConsole$set_connection()}} } } \if{html}{\out{
Inherited methods

- `lgr::Filterable$add_filter()`
- `lgr::Filterable$filter()`
- `lgr::Filterable$remove_filter()`
- `lgr::Filterable$set_filters()`
- `lgr::Appender$format()`
- `lgr::Appender$set_layout()`
- `lgr::Appender$set_threshold()`

}} \if{html}{\out{

}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-AppenderConsole-new}{}}} \subsection{Method \code{new()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{AppenderConsole$new( threshold = NA_integer_, layout = LayoutFormat$new(fmt = "\%L [\%t] \%m \%f", timestamp_fmt = "\%H:\%M:\%OS3", colors = getOption("lgr.colors", list())), filters = NULL, connection = NULL )}\if{html}{\out{
}} } \subsection{Arguments}{ \if{html}{\out{
}} \describe{ \item{\code{connection}}{A connection or a \code{character} scalar. See the \code{file} argument of \code{\link[=cat]{cat()}} for more details. Defaults to \code{\link[=stdout]{stdout()}}, except inside \pkg{knitr} rendering processes where it defaults to \code{\link[=stderr]{stderr()}}.} } \if{html}{\out{
}} } } \if{html}{\out{

}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-AppenderConsole-append}{}}} \subsection{Method \code{append()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{AppenderConsole$append(event)}\if{html}{\out{
}} } } \if{html}{\out{

}} \if{html}{\out{}} \if{latex}{\out{\hypertarget{method-AppenderConsole-set_connection}{}}} \subsection{Method \code{set_connection()}}{ \subsection{Usage}{ \if{html}{\out{
}}\preformatted{AppenderConsole$set_connection(connection)}\if{html}{\out{
}} } \subsection{Arguments}{ \if{html}{\out{
}} \describe{ \item{\code{connection}}{A connection or a \code{character} scalar. See the \code{file} argument of \code{\link[=cat]{cat()}} for more details. Defaults to \code{\link[=stdout]{stdout()}}, except inside \pkg{knitr} rendering processes where it defaults to \code{\link[=stderr]{stderr()}}.} } \if{html}{\out{
}} } } }