logger/ 0000755 0001762 0000144 00000000000 14571643063 011542 5 ustar ligges users logger/NAMESPACE 0000644 0001762 0000144 00000003727 14571077771 013001 0 ustar ligges users # Generated by roxygen2: do not edit by hand
S3method(as.loglevel,character)
S3method(as.loglevel,default)
S3method(as.loglevel,integer)
S3method(as.loglevel,numeric)
S3method(print,loglevel)
export("%except%")
export(DEBUG)
export(ERROR)
export(FATAL)
export(INFO)
export(OFF)
export(SUCCESS)
export(TRACE)
export(WARN)
export(appender_async)
export(appender_console)
export(appender_file)
export(appender_kinesis)
export(appender_pushbullet)
export(appender_slack)
export(appender_stderr)
export(appender_stdout)
export(appender_syslog)
export(appender_syslognet)
export(appender_tee)
export(appender_telegram)
export(appender_void)
export(as.loglevel)
export(colorize_by_log_level)
export(delete_logger_index)
export(deparse_to_one_line)
export(fail_on_missing_package)
export(formatter_glue)
export(formatter_glue_or_sprintf)
export(formatter_glue_safe)
export(formatter_json)
export(formatter_logging)
export(formatter_pander)
export(formatter_paste)
export(formatter_sprintf)
export(get_logger_meta_variables)
export(grayscale_by_log_level)
export(layout_blank)
export(layout_glue)
export(layout_glue_colors)
export(layout_glue_generator)
export(layout_json)
export(layout_json_parser)
export(layout_logging)
export(layout_simple)
export(layout_syslognet)
export(log_appender)
export(log_debug)
export(log_error)
export(log_errors)
export(log_eval)
export(log_failure)
export(log_fatal)
export(log_formatter)
export(log_info)
export(log_layout)
export(log_level)
export(log_messages)
export(log_namespaces)
export(log_separator)
export(log_shiny_input_changes)
export(log_success)
export(log_threshold)
export(log_tictoc)
export(log_trace)
export(log_warn)
export(log_warnings)
export(log_with_separator)
export(logger)
export(skip_formatter)
export(with_log_threshold)
importFrom(utils,assignInMyNamespace)
importFrom(utils,assignInNamespace)
importFrom(utils,capture.output)
importFrom(utils,compareVersion)
importFrom(utils,getFromNamespace)
importFrom(utils,packageVersion)
importFrom(utils,str)
logger/demo/ 0000755 0001762 0000144 00000000000 13375516546 012474 5 ustar ligges users logger/demo/colors.R 0000644 0001762 0000144 00000000640 13375124527 014112 0 ustar ligges users suppressWarnings(suppressMessages(library(logger)))
log_layout(layout_glue_colors)
log_threshold(TRACE)
log_info('Starting the script...')
log_debug('This is the second line')
log_trace('That is being placed right after the first one.')
log_warn('Some errors might come!')
log_error('This is a problem')
log_debug('Getting an error is usually bad')
log_error('This is another problem')
log_fatal('The last problem.') logger/demo/00Index 0000644 0001762 0000144 00000000040 13375516546 013620 0 ustar ligges users colors Using a colored layout
logger/README.md 0000644 0001762 0000144 00000016045 14567717130 013031 0 ustar ligges users # logger
[](https://www.repostatus.org/#active) [](https://cran.r-project.org/package=logger) [](https://github.com/daroczig/logger/actions) [](https://app.codecov.io/gh/daroczig/logger) [](https://mikata.dev)
A lightweight, modern and flexibly logging utility for R -- heavily inspired by the `futile.logger` R package and `logging` Python module.
## Installation
[](https://cran.r-project.org/package=logger)
```r
install.packages('logger')
```
The most recent, development version of `logger` can also be installed from GitHub:
```r
remotes::install_github('daroczig/logger')
```
## Quick example
Setting the log level threshold to something low and logging various messages in ad-hoc and programmatic ways:
```r
library(logger)
log_threshold(DEBUG)
log_info('Script starting up...')
#> INFO [2018-20-11 22:49:36] Script starting up...
pkgs <- available.packages()
log_info('There are {nrow(pkgs)} R packages hosted on CRAN!')
#> INFO [2018-20-11 22:49:37] There are 13433 R packages hosted on CRAN!
for (letter in letters) {
lpkgs <- sum(grepl(letter, pkgs[, 'Package'], ignore.case = TRUE))
log_level(if (lpkgs < 5000) TRACE else DEBUG,
'{lpkgs} R packages including the {shQuote(letter)} letter')
}
#> DEBUG [2018-20-11 22:49:38] 6300 R packages including the 'a' letter
#> DEBUG [2018-20-11 22:49:38] 6772 R packages including the 'e' letter
#> DEBUG [2018-20-11 22:49:38] 5412 R packages including the 'i' letter
#> DEBUG [2018-20-11 22:49:38] 7014 R packages including the 'r' letter
#> DEBUG [2018-20-11 22:49:38] 6402 R packages including the 's' letter
#> DEBUG [2018-20-11 22:49:38] 5864 R packages including the 't' letter
log_warn('There might be many, like {1:2} or more warnings!!!')
#> WARN [2018-20-11 22:49:39] There might be many, like 1 or more warnings!!!
#> WARN [2018-20-11 22:49:39] There might be many, like 2 or more warnings!!!
```
Setting a custom log layout to render the log records with colors:
```r
library(logger)
log_layout(layout_glue_colors)
log_threshold(TRACE)
log_info('Starting the script...')
log_debug('This is the second log line')
log_trace('Note that the 2nd line is being placed right after the 1st one.')
log_success('Doing pretty well so far!')
log_warn('But beware, as some errors might come :/')
log_error('This is a problem')
log_debug('Note that getting an error is usually bad')
log_error('This is another problem')
log_fatal('The last problem')
```
Or simply run the related demo:
```r
demo(colors, package = 'logger', echo = FALSE)
```
But you could set up any custom colors and layout, eg using custom colors only for the log levels, make it grayscale, include the calling function or R package namespace with specific colors etc. For more details, see the related vignettes.
## Why yet another logging R package?
Although there are multiple pretty good options already hosted on CRAN when it comes to logging in R, such as
- [`futile.logger`](https://cran.r-project.org/package=futile.logger): probably the most popular `log4j` variant (and I'm a big fan)
- [`logging`](https://cran.r-project.org/package=logging): just like Python's `logging` package
- [`loggit`](https://cran.r-project.org/package=loggit): capture `message`, `warning` and `stop` function messages in a JSON file
- [`log4r`](https://cran.r-project.org/package=log4r): `log4j`-based, object-oriented logger
- [`rsyslog`](https://cran.r-project.org/package=rsyslog): logging to `syslog` on 'POSIX'-compatible operating systems
- [`lumberjack`](https://cran.r-project.org/package=lumberjack): provides a special operator to log changes in data
Also many more work-in-progress R packages hosted on eg GitHub, such as
- https://github.com/smbache/loggr
- https://github.com/nfultz/tron
- https://github.com/metrumresearchgroup/logrrr
- https://github.com/lorenzwalthert/drogger
- https://github.com/s-fleck/yog
But some/most of these packages are
- not actively maintained any more, and/or maintainers are not being open for new features / patches
- not being modular enough for extensions
- prone to scoping issues
- using strange syntax elements, eg dots in function names or object-oriented approaches not being very familiar to most R users
- requires a lot of typing and code repetitions
So based on all the above subjective opinions, I decided to write the `n+1`th extensible `log4j` logger that fits my liking -- and hopefully yours as well -- with the focus being on:
- keep it close to `log4j`
- respect the most recent function / variable naming conventions and general R coding style
- by default, rely on `glue` when it comes to formatting / rendering log messages, but keep it flexible if others prefer `sprintf` (eg for performance reasons) or other functions
- support vectorization (eg passing a vector to be logged on multiple lines)
- make it easy to extend with new features (eg custom layouts, message formats and output)
- prepare for writing to various services, streams etc
- provide support for namespaces, preferably automatically finding and creating a custom namespace for all R packages writing log messages, each with optionally configurable log level threshold, message and output formats
- allow stacking loggers to implement logger hierarchy -- even within a namespace, so that the very same `log` call can write all the `TRACE` log messages to the console, while only pushing `ERROR`s to DataDog and eg `INFO` messages to CloudWatch
- optionally colorize log message based on the log level
- make logging fun
Welcome to the [Bazaar](https://en.wikipedia.org/wiki/The_Cathedral_and_the_Bazaar), and if you have happened to already use any of the above mentioned R packages for logging, you might find useful the [Migration Guide](https://daroczig.github.io/logger/articles/migration.html).
## Interested in more details?
Check out the main documentation site at https://daroczig.github.io/logger or the vignettes on the below topics:
* [Introduction to logger](https://daroczig.github.io/logger/articles/Intro.html)
* [The Anatomy of a Log Request](https://daroczig.github.io/logger/articles/anatomy.html)
* [Customizing the Format and the Destination of a Log Record](https://daroczig.github.io/logger/articles/customize_logger.html)
* [Writing Custom Logger Extensions](https://daroczig.github.io/logger/articles/write_custom_extensions.html)
* [Migration Guide from other logging packages](https://daroczig.github.io/logger/articles/migration.html)
* [Logging from R Packages](https://daroczig.github.io/logger/articles/r_packages.html)
* [Simple Benchmarks on Performance](https://daroczig.github.io/logger/articles/performance.html)
logger/man/ 0000755 0001762 0000144 00000000000 14571101564 012310 5 ustar ligges users logger/man/layout_logging.Rd 0000644 0001762 0000144 00000003557 13770625564 015647 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layouts.R
\name{layout_logging}
\alias{layout_logging}
\title{Format a log record as the logging package does by default}
\usage{
layout_logging(
level,
msg,
namespace = NA_character_,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{level}{log level, see \code{\link{log_levels}} for more details}
\item{msg}{string message}
\item{namespace}{string referring to the \code{logger} environment / config to be used to override the target of the message record to be used instead of the default namespace, which is defined by the R package name from which the logger was called, and falls back to a common, global namespace.}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
Format a log record as the logging package does by default
}
\examples{
\dontrun{
log_layout(layout_logging)
log_info(42)
log_info(42, namespace = 'everything')
devtools::load_all(system.file('demo-packages/logger-tester-package', package = 'logger'))
logger_tester_function(INFO, 42)
}
}
\seealso{
This is a \code{\link{log_layout}}, for alternatives, see \code{\link{layout_blank}}, \code{\link{layout_glue}}, \code{\link{layout_glue_colors}}, \code{\link{layout_json}}, \code{\link{layout_json_parser}}, or generator functions such as \code{\link{layout_glue_generator}}
}
logger/man/log_shiny_input_changes.Rd 0000644 0001762 0000144 00000002302 14567717130 017505 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hooks.R
\name{log_shiny_input_changes}
\alias{log_shiny_input_changes}
\title{Auto logging input changes in Shiny app}
\usage{
log_shiny_input_changes(
input,
level = INFO,
namespace = NA_character_,
excluded_inputs = character()
)
}
\arguments{
\item{input}{passed from Shiny's \code{server}}
\item{level}{log level}
\item{namespace}{the name of the namespace}
\item{excluded_inputs}{character vector of input names to exclude from logging}
}
\description{
This is to be called in the \code{server} section of the Shiny app.
}
\examples{
\dontrun{
library(shiny)
ui <- bootstrapPage(
numericInput('mean', 'mean', 0),
numericInput('sd', 'sd', 1),
textInput('title', 'title', 'title'),
textInput('foo', 'This is not used at all, still gets logged', 'foo'),
passwordInput('password', 'Password not to be logged', 'secret'),
plotOutput('plot')
)
server <- function(input, output) {
logger::log_shiny_input_changes(input, excluded_inputs = 'password')
output$plot <- renderPlot({
hist(rnorm(1e3, input$mean, input$sd), main = input$title)
})
}
shinyApp(ui = ui, server = server)
}
}
logger/man/layout_blank.Rd 0000644 0001762 0000144 00000003172 13770625564 015301 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layouts.R
\name{layout_blank}
\alias{layout_blank}
\title{Format a log record by including the raw message without anything added or modified}
\usage{
layout_blank(
level,
msg,
namespace = NA_character_,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{level}{log level, see \code{\link{log_levels}} for more details}
\item{msg}{string message}
\item{namespace}{string referring to the \code{logger} environment / config to be used to override the target of the message record to be used instead of the default namespace, which is defined by the R package name from which the logger was called, and falls back to a common, global namespace.}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
Format a log record by including the raw message without anything added or modified
}
\seealso{
This is a \code{\link{log_layout}}, for alternatives, see \code{\link{layout_simple}}, \code{\link{layout_glue_colors}}, \code{\link{layout_json}}, or generator functions such as \code{\link{layout_glue_generator}}
}
logger/man/appender_void.Rd 0000644 0001762 0000144 00000000533 14571077771 015433 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_void}
\alias{appender_void}
\title{Dummy appender not delivering the log record to anywhere}
\usage{
appender_void(lines)
}
\arguments{
\item{lines}{character vector}
}
\description{
Dummy appender not delivering the log record to anywhere
}
logger/man/layout_glue_generator.Rd 0000644 0001762 0000144 00000002302 13770625564 017206 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layouts.R
\name{layout_glue_generator}
\alias{layout_glue_generator}
\title{Generate log layout function using common variables available via glue syntax}
\usage{
layout_glue_generator(
format = "{level} [{format(time, \\"\%Y-\%m-\%d \%H:\%M:\%S\\")}] {msg}"
)
}
\arguments{
\item{format}{\code{glue}-flavored layout of the message using the above variables}
}
\value{
function taking \code{level} and \code{msg} arguments - keeping the original call creating the generator in the \code{generator} attribute that is returned when calling \code{\link{log_layout}} for the currently used layout
}
\description{
\code{format} is passed to \code{glue} with access to the below variables:
\itemize{
\item msg: the actual log message
\item further variables set by \code{\link{get_logger_meta_variables}}
}
}
\examples{
\dontrun{
example_layout <- layout_glue_generator(
format = '{node}/{pid}/{ns}/{ans}/{topenv}/{fn} {time} {level}: {msg}')
example_layout(INFO, 'try {runif(1)}')
log_layout(example_layout)
log_info('try {runif(1)}')
}
}
\seealso{
See example calls from \code{\link{layout_glue}} and \code{\link{layout_glue_colors}}.
}
logger/man/appender_syslognet.Rd 0000644 0001762 0000144 00000001443 14020000764 016473 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_syslognet}
\alias{appender_syslognet}
\title{Send log messages to a network syslog server}
\usage{
appender_syslognet(identifier, server, port = 601L)
}
\arguments{
\item{identifier}{program/function identification (string).}
\item{server}{machine where syslog daemon runs (string).}
\item{port}{port where syslog daemon listens (integer).}
}
\value{
A function taking a \code{lines} argument.
}
\description{
Send log messages to a network syslog server
}
\note{
This functionality depends on the \pkg{syslognet} package.
}
\examples{
\dontrun{
if (requireNamespace("syslognet", quietly = TRUE)) {
log_appender(appender_syslognet("test_app", 'remoteserver'))
log_info("Test message.")
}
}
}
logger/man/warn_if_globalCallingHandlers_is_not_available.Rd 0000644 0001762 0000144 00000000527 13770625564 024111 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hooks.R
\name{warn_if_globalCallingHandlers_is_not_available}
\alias{warn_if_globalCallingHandlers_is_not_available}
\title{Warn to update R to 4+}
\usage{
warn_if_globalCallingHandlers_is_not_available()
}
\description{
Warn to update R to 4+
}
\keyword{internal}
logger/man/log_warnings.Rd 0000644 0001762 0000144 00000001150 14570721542 015270 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hooks.R
\name{log_warnings}
\alias{log_warnings}
\title{Injects a logger call to standard warnings}
\usage{
log_warnings(muffle = getOption("logger_muffle_warnings", FALSE))
}
\arguments{
\item{muffle}{if TRUE, the warning is not shown after being logged}
}
\description{
This function uses \code{trace} to add a \code{log_warn} function call when \code{warning} is called to log the warning messages with the \code{logger} layout and appender.
}
\examples{
\dontrun{
log_warnings()
for (i in 1:5) { Sys.sleep(runif(1)); warning(i) }
}
}
logger/man/log_eval.Rd 0000644 0001762 0000144 00000003021 13400221416 014350 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{log_eval}
\alias{log_eval}
\title{Evaluate an expression and log results}
\usage{
log_eval(expr, level = TRACE, multiline = FALSE)
}
\arguments{
\item{expr}{R expression to be evaluated while logging the expression itself along with the result}
\item{level}{\code{\link{log_levels}}}
\item{multiline}{setting to \code{FALSE} will print both the expression (enforced to be on one line by removing line-breaks if any) and its result on a single line separated by \code{=>}, while setting to \code{TRUE} will log the expression and the result in separate sections reserving line-breaks and rendering the printed results}
}
\description{
Evaluate an expression and log results
}
\examples{
\dontrun{
log_eval(pi * 2, level = INFO)
## lowering the log level threshold so that we don't have to set a higher level in log_eval
log_threshold(TRACE)
log_eval(x <- 4)
log_eval(sqrt(x))
## log_eval can be called in-line as well as returning the return value of the expression
x <- log_eval(mean(runif(1e3)))
x
## https://twitter.com/krlmlr/status/1067864829547999232
f <- sqrt
g <- mean
x <- 1:31
log_eval(f(g(x)), level = INFO)
log_eval(y <- f(g(x)), level = INFO)
## returning a function
log_eval(f <- sqrt)
log_eval(f)
## evaluating something returning a wall of "text"
log_eval(f <- log_eval)
log_eval(f <- log_eval, multiline = TRUE)
## doing something computationally intensive
log_eval(system.time(for(i in 1:100) mad(runif(1000))), multiline = TRUE)
}
}
logger/man/catch_base_log.Rd 0000644 0001762 0000144 00000001364 14567717130 015527 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{catch_base_log}
\alias{catch_base_log}
\title{Catch the log header}
\usage{
catch_base_log(
level,
namespace,
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{level}{see \code{\link{log_levels}}}
\item{namespace}{string}
}
\value{
string
}
\description{
Catch the log header
}
\examples{
\dontrun{
catch_base_log(INFO, NA_character_)
logger <- layout_glue_generator(format = '{node}/{pid}/{namespace}/{fn} {time} {level}: {msg}')
log_layout(logger)
catch_base_log(INFO, NA_character_)
fun <- function() catch_base_log(INFO, NA_character_)
fun()
catch_base_log(INFO, NA_character_, .topcall = call('funLONG'))
}
}
\keyword{internal}
logger/man/formatter_pander.Rd 0000644 0001762 0000144 00000002764 14570721542 016147 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formatters.R
\name{formatter_pander}
\alias{formatter_pander}
\title{Formats R objects with pander}
\usage{
formatter_pander(
x,
...,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{x}{object to be logged}
\item{...}{optional parameters passed to \code{pander}}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
Formats R objects with pander
}
\note{
This functionality depends on the \pkg{pander} package.
}
\examples{
\dontrun{
log_formatter(formatter_pander)
log_info('42')
log_info(42)
log_info(4+2)
log_info(head(iris))
log_info(head(iris), style = 'simple')
log_info(lm(hp ~ wt, mtcars))
}
}
\seealso{
This is a \code{\link{log_formatter}}, for alternatives, see \code{\link{formatter_paste}}, \code{\link{formatter_sprintf}}, \code{\link{formatter_glue}}, \code{\link{formatter_glue_safe}}, \code{\link{formatter_glue_or_sprintf}}, \code{\link{formatter_logging}}
}
logger/man/fallback_namespace.Rd 0000644 0001762 0000144 00000000637 13406041521 016350 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logger.R
\name{fallback_namespace}
\alias{fallback_namespace}
\title{Checks if provided namespace exists and falls back to global if not}
\usage{
fallback_namespace(namespace)
}
\arguments{
\item{namespace}{string}
}
\value{
string
}
\description{
Checks if provided namespace exists and falls back to global if not
}
\keyword{internal}
logger/man/log_level.Rd 0000644 0001762 0000144 00000005531 14571077771 014567 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logger.R
\name{log_level}
\alias{log_level}
\alias{log_fatal}
\alias{log_error}
\alias{log_warn}
\alias{log_success}
\alias{log_info}
\alias{log_debug}
\alias{log_trace}
\title{Log a message with given log level}
\usage{
log_level(level, ..., namespace = NA_character_,
.logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame())
log_trace(..., namespace = NA_character_,
.logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame())
log_debug(..., namespace = NA_character_,
.logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame())
log_info(..., namespace = NA_character_,
.logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame())
log_success(..., namespace = NA_character_,
.logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame())
log_warn(..., namespace = NA_character_,
.logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame())
log_error(..., namespace = NA_character_,
.logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame())
log_fatal(..., namespace = NA_character_,
.logcall = sys.call(), .topcall = sys.call(-1), .topenv = parent.frame())
}
\arguments{
\item{level}{log level, see \code{\link{log_levels}} for more details}
\item{...}{R objects that can be converted to a character vector via the active message formatter function}
\item{namespace}{string referring to the \code{logger} environment / config to be used to override the target of the message record to be used instead of the default namespace, which is defined by the R package name from which the logger was called, and falls back to a common, global namespace.}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
Invisible \code{list} of \code{logger} objects. See \code{\link{logger}} for more details on the format/
}
\description{
Log a message with given log level
}
\examples{
\dontrun{
log_level(INFO, 'hi there')
log_info('hi there')
## output omitted
log_debug('hi there')
## lower threshold and retry
log_threshold(TRACE)
log_debug('hi there')
## multiple lines
log_info('ok {1:3} + {1:3} = {2*(1:3)}')
log_layout(layout_json())
log_info('ok {1:3} + {1:3} = {2*(1:3)}')
## note for the JSON output, glue is not automatically applied
log_info(glue::glue('ok {1:3} + {1:3} = {2*(1:3)}'))
}
}
\seealso{
\code{\link{logger}}
}
logger/man/log_with_separator.Rd 0000644 0001762 0000144 00000003465 14567717130 016512 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/helpers.R
\name{log_with_separator}
\alias{log_with_separator}
\title{Logs a message in a very visible way}
\usage{
log_with_separator(
...,
level = INFO,
namespace = NA_character_,
separator = "=",
width = 80
)
}
\arguments{
\item{...}{R objects that can be converted to a character vector via the active message formatter function}
\item{level}{log level, see \code{\link{log_levels}} for more details}
\item{namespace}{string referring to the \code{logger} environment / config to be used to override the target of the message record to be used instead of the default namespace, which is defined by the R package name from which the logger was called, and falls back to a common, global namespace.}
\item{separator}{character to be used as a separator}
\item{width}{max width of message -- longer text will be wrapped into multiple lines}
}
\description{
Logs a message in a very visible way
}
\examples{
log_with_separator('An important message')
log_with_separator('Some critical KPI down!!!', separator = '$')
log_with_separator('This message is worth a {1e3} words')
log_with_separator(paste(
'A very important message with a bunch of extra words that will',
'eventually wrap into a multi-line message for our quite nice demo :wow:'))
log_with_separator(paste(
'A very important message with a bunch of extra words that will',
'eventually wrap into a multi-line message for our quite nice demo :wow:'),
width = 60)
log_with_separator('Boo!', level = FATAL)
log_layout(layout_blank)
log_with_separator('Boo!', level = FATAL)
logger <- layout_glue_generator(format = '{node}/{pid}/{namespace}/{fn} {time} {level}: {msg}')
log_layout(logger)
log_with_separator('Boo!', level = FATAL, width = 120)
}
\seealso{
\code{\link{log_separator}}
}
logger/man/formatter_paste.Rd 0000644 0001762 0000144 00000002563 14570721542 016007 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formatters.R
\name{formatter_paste}
\alias{formatter_paste}
\title{Concatenate R objects into a character vector via \code{paste}}
\usage{
formatter_paste(
...,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{...}{passed to \code{paste}}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
Concatenate R objects into a character vector via \code{paste}
}
\seealso{
This is a \code{\link{log_formatter}}, for alternatives, see \code{\link{formatter_sprintf}}, \code{\link{formatter_glue}}, \code{\link{formatter_glue_safe}}, \code{\link{formatter_glue_or_sprintf}}, \code{\link{formatter_logging}}, \code{\link{formatter_json}}, \code{\link{formatter_pander}} and \code{\link{skip_formatter}} for marking a string not to apply the formatter on it.
}
logger/man/appender_tee.Rd 0000644 0001762 0000144 00000002542 14567717130 015244 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_tee}
\alias{appender_tee}
\title{Append log messages to a file and stdout as well}
\usage{
appender_tee(
file,
append = TRUE,
max_lines = Inf,
max_bytes = Inf,
max_files = 1L
)
}
\arguments{
\item{file}{path}
\item{append}{boolean passed to \code{cat} defining if the file should be overwritten with the most recent log message instead of appending}
\item{max_lines}{numeric specifying the maximum number of lines allowed in a file before rotating}
\item{max_bytes}{numeric specifying the maximum number of bytes allowed in a file before rotating}
\item{max_files}{integer specifying the maximum number of files to be used in rotation}
}
\value{
function taking \code{lines} argument
}
\description{
This appends log messages to both console and a file. The same rotation options are available as in \code{\link{appender_file}}.
}
\seealso{
This is generator function for \code{\link{log_appender}}, for alternatives, see eg \code{\link{appender_console}}, \code{\link{appender_file}}, \code{\link{appender_slack}}, \code{\link{appender_pushbullet}}, \code{\link{appender_telegram}}, \code{\link{appender_syslog}}, \code{\link{appender_kinesis}} and \code{\link{appender_async}} for evaluate any \code{\link{log_appender}} function in a background process.
}
logger/man/formatter_logging.Rd 0000644 0001762 0000144 00000003472 14570721542 016321 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formatters.R
\name{formatter_logging}
\alias{formatter_logging}
\title{Mimic the default formatter used in the \pkg{logging} package}
\usage{
formatter_logging(
...,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{...}{string and further params passed to \code{sprintf} or R expressions to be evaluated}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
The \pkg{logging} package uses a formatter that behaves differently when the input is a string or other R object. If the first argument is a string, then \code{\link{sprintf}} is being called -- otherwise it does something like \code{\link{log_eval}} and logs the R expression(s) and the result(s) as well.
}
\examples{
\dontrun{
log_formatter(formatter_logging)
log_info('42')
log_info(42)
log_info(4+2)
log_info('foo \%s', 'bar')
log_info('vector \%s', 1:3)
log_info(12, 1+1, 2 * 2)
}
}
\seealso{
This is a \code{\link{log_formatter}}, for alternatives, see \code{\link{formatter_paste}}, \code{\link{formatter_glue}}, \code{\link{formatter_glue_safe}}, \code{\link{formatter_glue_or_sprintf}}, \code{\link{formatter_json}}, \code{\link{formatter_pander}} and \code{\link{skip_formatter}} for marking a string not to apply the formatter on it.
}
logger/man/formatter_glue.Rd 0000644 0001762 0000144 00000003063 14570721542 015623 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formatters.R
\name{formatter_glue}
\alias{formatter_glue}
\title{Apply \code{glue} to convert R objects into a character vector}
\usage{
formatter_glue(
...,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{...}{passed to \code{glue} for the text interpolation}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
Apply \code{glue} to convert R objects into a character vector
}
\note{
Although this is the default log message formatter function, but when \pkg{glue} is not installed, \code{\link{formatter_sprintf}} will be used as a fallback.
}
\seealso{
This is a \code{\link{log_formatter}}, for alternatives, see \code{\link{formatter_paste}}, \code{\link{formatter_sprintf}}, \code{\link{formatter_glue_or_sprintf}}, \code{\link{formatter_glue_safe}}, \code{\link{formatter_logging}}, \code{\link{formatter_json}}, \code{\link{formatter_pander}} and \code{\link{skip_formatter}} for marking a string not to apply the formatter on it.
}
logger/man/layout_json_parser.Rd 0000644 0001762 0000144 00000002367 13770625564 016544 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layouts.R
\name{layout_json_parser}
\alias{layout_json_parser}
\title{Generate log layout function rendering JSON after merging meta fields with parsed list from JSON message}
\usage{
layout_json_parser(
fields = c("time", "level", "ns", "ans", "topenv", "fn", "node", "arch", "os_name",
"os_release", "os_version", "pid", "user")
)
}
\arguments{
\item{fields}{character vector of field names to be included in the JSON}
}
\description{
Generate log layout function rendering JSON after merging meta fields with parsed list from JSON message
}
\note{
This functionality depends on the \pkg{jsonlite} package.
}
\examples{
\dontrun{
log_formatter(formatter_json)
log_info(everything = 42)
log_layout(layout_json_parser())
log_info(everything = 42)
log_layout(layout_json_parser(fields = c('time', 'node')))
log_info(cars = row.names(mtcars), species = unique(iris$Species))
}
}
\seealso{
This is a \code{\link{log_layout}} potentially to be used with \code{\link{formatter_json}}, for alternatives, see \code{\link{layout_simple}}, \code{\link{layout_glue}}, \code{\link{layout_glue_colors}}, \code{\link{layout_json}} or generator functions such as \code{\link{layout_glue_generator}}
}
logger/man/log_config_setter.Rd 0000644 0001762 0000144 00000001036 14567717130 016302 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logger.R
\name{log_config_setter}
\alias{log_config_setter}
\title{Base Logging Function}
\usage{
log_config_setter(fun_name, arg, namespace, index)
}
\arguments{
\item{fun_name}{string a full name of log function}
\item{arg}{see \code{\link{log_levels}}}
\item{namespace}{logger namespace}
\item{index}{index of the logger within the namespace}
}
\value{
currently set or return log function property
}
\description{
Base Logging Function
}
\keyword{internal}
logger/man/layout_glue_colors.Rd 0000644 0001762 0000144 00000004166 13770625564 016533 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layouts.R
\name{layout_glue_colors}
\alias{layout_glue_colors}
\title{Format a log message with \code{glue} and ANSI escape codes to add colors}
\usage{
layout_glue_colors(
level,
msg,
namespace = NA_character_,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{level}{log level, see \code{\link{log_levels}} for more details}
\item{msg}{string message}
\item{namespace}{string referring to the \code{logger} environment / config to be used to override the target of the message record to be used instead of the default namespace, which is defined by the R package name from which the logger was called, and falls back to a common, global namespace.}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
Format a log message with \code{glue} and ANSI escape codes to add colors
}
\note{
This functionality depends on the \pkg{crayon} package.
}
\examples{
\dontrun{
log_layout(layout_glue_colors)
log_threshold(TRACE)
log_info('Starting the script...')
log_debug('This is the second line')
log_trace('That is being placed right after the first one.')
log_warn('Some errors might come!')
log_error('This is a problem')
log_debug('Getting an error is usually bad')
log_error('This is another problem')
log_fatal('The last problem.')
}
}
\seealso{
This is a \code{\link{log_layout}}, for alternatives, see \code{\link{layout_blank}}, \code{\link{layout_simple}}, \code{\link{layout_glue}}, \code{\link{layout_json}}, \code{\link{layout_json_parser}}, or generator functions such as \code{\link{layout_glue_generator}}
}
logger/man/formatter_glue_safe.Rd 0000644 0001762 0000144 00000002702 14570721542 016620 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formatters.R
\name{formatter_glue_safe}
\alias{formatter_glue_safe}
\title{Apply \code{glue_safe} to convert R objects into a character vector}
\usage{
formatter_glue_safe(
...,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{...}{passed to \code{glue_safe} for the text interpolation}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
Apply \code{glue_safe} to convert R objects into a character vector
}
\seealso{
This is a \code{\link{log_formatter}}, for alternatives, see \code{\link{formatter_glue}}, \code{\link{formatter_paste}}, \code{\link{formatter_sprintf}}, \code{\link{formatter_glue}}, \code{\link{formatter_glue_or_sprintf}}, \code{\link{formatter_logging}}, \code{\link{formatter_json}}, \code{\link{formatter_pander}} and \code{\link{skip_formatter}} for marking a string not to apply the formatter on it.
}
logger/man/log_errors.Rd 0000644 0001762 0000144 00000001063 14570721542 014757 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/hooks.R
\name{log_errors}
\alias{log_errors}
\title{Injects a logger call to standard errors}
\usage{
log_errors(muffle = getOption("logger_muffle_errors", FALSE))
}
\arguments{
\item{muffle}{if TRUE, the error is not thrown after being logged}
}
\description{
This function uses \code{trace} to add a \code{log_error} function call when \code{stop} is called to log the error messages with the \code{logger} layout and appender.
}
\examples{
\dontrun{
log_errors()
stop('foobar')
}
}
logger/man/log_levels.Rd 0000644 0001762 0000144 00000002606 14571101712 014731 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/levels.R
\docType{data}
\name{OFF}
\alias{OFF}
\alias{log_levels}
\alias{FATAL}
\alias{ERROR}
\alias{WARN}
\alias{SUCCESS}
\alias{INFO}
\alias{DEBUG}
\alias{TRACE}
\title{Log levels}
\format{
An object of class \code{loglevel} (inherits from \code{integer}) of length 1.
}
\usage{
TRACE
DEBUG
INFO
SUCCESS
WARN
ERROR
FATAL
OFF
}
\description{
The standard Apache logj4 log levels plus a custom level for \code{SUCCESS}. For the full list of these log levels and suggested usage, check the below Details.
}
\details{
List of supported log levels:
\enumerate{
\item \code{OFF} No events will be logged
\item \code{FATAL} Severe error that will prevent the application from continuing
\item \code{ERROR} An error in the application, possibly recoverable
\item \code{WARN} An event that might possible lead to an error
\item \code{SUCCESS} An explicit success event above the INFO level that you want to log
\item \code{INFO} An event for informational purposes
\item \code{DEBUG} A general debugging event
\item \code{TRACE} A fine-grained debug message, typically capturing the flow through the application.
}
}
\references{
\url{https://logging.apache.org/log4j/2.x/javadoc/log4j-api/org/apache/logging/log4j/Level.html}, \url{https://logging.apache.org/log4j/2.x/manual/customloglevels.html}
}
\keyword{datasets}
logger/man/appender_slack.Rd 0000644 0001762 0000144 00000002434 13770625564 015570 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_slack}
\alias{appender_slack}
\title{Send log messages to a Slack channel}
\usage{
appender_slack(
channel = Sys.getenv("SLACK_CHANNEL"),
username = Sys.getenv("SLACK_USERNAME"),
icon_emoji = Sys.getenv("SLACK_ICON_EMOJI"),
api_token = Sys.getenv("SLACK_API_TOKEN"),
preformatted = TRUE
)
}
\arguments{
\item{channel}{Slack channel name with a hashtag prefix for public channel and no prefix for private channels}
\item{username}{Slack (bot) username}
\item{icon_emoji}{optional override for the bot icon}
\item{api_token}{Slack API token}
\item{preformatted}{use code tags around the message?}
}
\value{
function taking \code{lines} argument
}
\description{
Send log messages to a Slack channel
}
\note{
This functionality depends on the \pkg{slackr} package.
}
\seealso{
This is generator function for \code{\link{log_appender}}, for alternatives, see eg \code{\link{appender_console}}, \code{\link{appender_file}}, \code{\link{appender_tee}}, \code{\link{appender_pushbullet}}, \code{\link{appender_telegram}}, \code{\link{appender_syslog}}, \code{\link{appender_kinesis}} and \code{\link{appender_async}} for evaluate any \code{\link{log_appender}} function in a background process.
}
logger/man/deparse_to_one_line.Rd 0000644 0001762 0000144 00000001036 13770625564 016607 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{deparse_to_one_line}
\alias{deparse_to_one_line}
\title{Deparse and join all lines into a single line}
\usage{
deparse_to_one_line(x)
}
\arguments{
\item{x}{object to \code{deparse}}
}
\value{
string
}
\description{
Calling \code{deparse} and joining all the returned lines into a
single line, separated by whitespace, and then cleaning up all the
duplicated whitespace (except for excessive whitespace in strings
between single or double quotes).
}
logger/man/appender_pushbullet.Rd 0000644 0001762 0000144 00000002007 13571735644 016656 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_pushbullet}
\alias{appender_pushbullet}
\title{Send log messages to Pushbullet}
\usage{
appender_pushbullet(...)
}
\arguments{
\item{...}{parameters passed to \code{pbPost}, such as \code{recipients} or \code{apikey}, although it's probably much better to set all these in the \code{~/.rpushbullet.json} as per package docs at \url{http://dirk.eddelbuettel.com/code/rpushbullet.html}}
}
\description{
Send log messages to Pushbullet
}
\note{
This functionality depends on the \pkg{RPushbullet} package.
}
\seealso{
This is generator function for \code{\link{log_appender}}, for alternatives, see eg \code{\link{appender_console}}, \code{\link{appender_file}}, \code{\link{appender_tee}}, \code{\link{appender_slack}}, \code{\link{appender_telegram}}, \code{\link{appender_syslog}}, \code{\link{appender_kinesis}} and \code{\link{appender_async}} for evaluate any \code{\link{log_appender}} function in a background process.
}
logger/man/appender_telegram.Rd 0000644 0001762 0000144 00000002172 13770625564 016272 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_telegram}
\alias{appender_telegram}
\title{Send log messages to a Telegram chat}
\usage{
appender_telegram(
chat_id = Sys.getenv("TELEGRAM_CHAT_ID"),
bot_token = Sys.getenv("TELEGRAM_BOT_TOKEN"),
parse_mode = NULL
)
}
\arguments{
\item{chat_id}{Unique identifier for the target chat or username of the target channel (in the format @channelusername)}
\item{bot_token}{Telegram Authorization token}
\item{parse_mode}{Message parse mode. Allowed values: Markdown or HTML}
}
\value{
function taking \code{lines} argument
}
\description{
Send log messages to a Telegram chat
}
\note{
This functionality depends on the \pkg{telegram} package.
}
\seealso{
This is generator function for \code{\link{log_appender}}, for alternatives, see eg \code{\link{appender_console}}, \code{\link{appender_file}}, \code{\link{appender_tee}}, \code{\link{appender_pushbullet}}, \code{\link{appender_syslog}}, \code{\link{appender_kinesis}} and \code{\link{appender_async}} for evaluate any \code{\link{log_appender}} function in a background process.
}
logger/man/log_threshold.Rd 0000644 0001762 0000144 00000002011 14567717130 015435 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/logger.R
\name{log_threshold}
\alias{log_threshold}
\title{Get or set log level threshold}
\usage{
log_threshold(level = NULL, namespace = "global", index = 1)
}
\arguments{
\item{level}{see \code{\link{log_levels}}}
\item{namespace}{logger namespace}
\item{index}{index of the logger within the namespace}
}
\value{
currently set log level threshold
}
\description{
Get or set log level threshold
}
\examples{
\dontrun{
## check the currently set log level threshold
log_threshold()
## change the log level threshold to WARN
log_threshold(WARN)
log_info(1)
log_warn(2)
## add another logger with a lower log level threshold and check the number of logged messages
log_threshold(INFO, index = 2)
log_info(1)
log_warn(2)
## set the log level threshold in all namespaces to ERROR
log_threshold(ERROR, namespace = log_namespaces())
}
}
\seealso{
\code{\link{logger}}, \code{\link{log_layout}}, \code{\link{log_formatter}}, \code{\link{log_appender}}
}
logger/man/formatter_glue_or_sprintf.Rd 0000644 0001762 0000144 00000004602 14570721542 020070 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/formatters.R
\name{formatter_glue_or_sprintf}
\alias{formatter_glue_or_sprintf}
\title{Apply \code{glue} and \code{sprintf}}
\usage{
formatter_glue_or_sprintf(
msg,
...,
.logcall = sys.call(),
.topcall = sys.call(-1),
.topenv = parent.frame()
)
}
\arguments{
\item{msg}{passed to \code{sprintf} as \code{fmt} or handled as part of \code{...} in \code{glue}}
\item{...}{passed to \code{glue} for the text interpolation}
\item{.logcall}{the logging call being evaluated (useful in formatters and layouts when you want to have access to the raw, unevaluated R expression)}
\item{.topcall}{R expression from which the logging function was called (useful in formatters and layouts to extract the calling function's name or arguments)}
\item{.topenv}{original frame of the \code{.topcall} calling function where the formatter function will be evaluated and that is used to look up the \code{namespace} as well via \code{logger:::top_env_name}}
}
\value{
character vector
}
\description{
The best of both words: using both formatter functions in your log messages, which can be useful eg if you are migrating from \code{sprintf} formatted log messages to \code{glue} or similar.
}
\details{
Note that this function tries to be smart when passing arguments to \code{glue} and \code{sprintf}, but might fail with some edge cases, and returns an unformatted string.
}
\examples{
\dontrun{
formatter_glue_or_sprintf("{a} + {b} = \%s", a = 2, b = 3, 5)
formatter_glue_or_sprintf("{pi} * {2} = \%s", pi*2)
formatter_glue_or_sprintf("{pi} * {2} = {pi*2}")
formatter_glue_or_sprintf("Hi ", "{c('foo', 'bar')}, did you know that 2*4={2*4}")
formatter_glue_or_sprintf("Hi {c('foo', 'bar')}, did you know that 2*4={2*4}")
formatter_glue_or_sprintf("Hi {c('foo', 'bar')}, did you know that 2*4=\%s", 2*4)
formatter_glue_or_sprintf("Hi \%s, did you know that 2*4={2*4}", c('foo', 'bar'))
formatter_glue_or_sprintf("Hi \%s, did you know that 2*4=\%s", c('foo', 'bar'), 2*4)
}
}
\seealso{
This is a \code{\link{log_formatter}}, for alternatives, see \code{\link{formatter_paste}}, \code{\link{formatter_sprintf}}, \code{\link{formatter_glue}}, \code{\link{formatter_glue_safe}}, \code{\link{formatter_logging}}, \code{\link{formatter_json}}, \code{\link{formatter_pander}} and \code{\link{skip_formatter}} for marking a string not to apply the formatter on it.
}
logger/man/appender_kinesis.Rd 0000644 0001762 0000144 00000001564 13571735644 016143 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_kinesis}
\alias{appender_kinesis}
\title{Send log messages to a Amazon Kinesis stream}
\usage{
appender_kinesis(stream)
}
\arguments{
\item{stream}{name of the Kinesis stream}
}
\value{
function taking \code{lines} and optional \code{partition_key} argument
}
\description{
Send log messages to a Amazon Kinesis stream
}
\note{
This functionality depends on the \pkg{botor} package.
}
\seealso{
This is generator function for \code{\link{log_appender}}, for alternatives, see eg \code{\link{appender_console}}, \code{\link{appender_file}}, \code{\link{appender_tee}}, \code{\link{appender_pushbullet}}, \code{\link{appender_telegram}}, \code{\link{appender_syslog}} and \code{\link{appender_async}} for evaluate any \code{\link{log_appender}} function in a background process.
}
logger/man/appender_syslog.Rd 0000644 0001762 0000144 00000002102 13571735644 016003 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_syslog}
\alias{appender_syslog}
\title{Send log messages to the POSIX system log}
\usage{
appender_syslog(identifier, ...)
}
\arguments{
\item{identifier}{A string identifying the process.}
\item{...}{Further arguments passed on to \code{\link[rsyslog]{open_syslog}}.}
}
\value{
function taking \code{lines} argument
}
\description{
Send log messages to the POSIX system log
}
\note{
This functionality depends on the \pkg{rsyslog} package.
}
\examples{
\dontrun{
if (requireNamespace("rsyslog", quietly = TRUE)) {
log_appender(appender_syslog("test"))
log_info("Test message.")
}
}
}
\seealso{
This is generator function for \code{\link{log_appender}}, for alternatives, see eg \code{\link{appender_console}}, \code{\link{appender_file}}, \code{\link{appender_tee}}, \code{\link{appender_pushbullet}}, \code{\link{appender_telegram}}, \code{\link{appender_kinesis}} and \code{\link{appender_async}} for evaluate any \code{\link{log_appender}} function in a background process.
}
logger/man/fail_on_missing_package.Rd 0000644 0001762 0000144 00000001063 14567717130 017421 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{fail_on_missing_package}
\alias{fail_on_missing_package}
\title{Check if R package can be loaded and fails loudly otherwise}
\usage{
fail_on_missing_package(pkg, min_version)
}
\arguments{
\item{pkg}{string}
\item{min_version}{optional minimum version needed}
}
\description{
Check if R package can be loaded and fails loudly otherwise
}
\examples{
\dontrun{
f <- function() fail_on_missing_package('foobar')
f()
g <- function() fail_on_missing_package('stats')
g()
}
}
logger/man/layout_json.Rd 0000644 0001762 0000144 00000001725 13770625564 015165 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/layouts.R
\name{layout_json}
\alias{layout_json}
\title{Generate log layout function rendering JSON}
\usage{
layout_json(
fields = c("time", "level", "ns", "ans", "topenv", "fn", "node", "arch", "os_name",
"os_release", "os_version", "pid", "user", "msg")
)
}
\arguments{
\item{fields}{character vector of field names to be included in the JSON}
}
\value{
character vector
}
\description{
Generate log layout function rendering JSON
}
\note{
This functionality depends on the \pkg{jsonlite} package.
}
\examples{
\dontrun{
log_layout(layout_json())
log_info(42)
log_info('ok {1:3} + {1:3} = {2*(1:3)}')
}
}
\seealso{
This is a \code{\link{log_layout}}, for alternatives, see \code{\link{layout_blank}}, \code{\link{layout_simple}}, \code{\link{layout_glue}}, \code{\link{layout_glue_colors}}, \code{\link{layout_json_parser}}, or generator functions such as \code{\link{layout_glue_generator}}
}
logger/man/appender_console.Rd 0000644 0001762 0000144 00000001414 13571735644 016132 0 ustar ligges users % Generated by roxygen2: do not edit by hand
% Please edit documentation in R/appenders.R
\name{appender_console}
\alias{appender_console}
\alias{appender_stderr}
\title{Append log record to stderr}
\usage{
appender_console(lines)
appender_stderr(lines)
}
\arguments{
\item{lines}{character vector}
}
\description{
Append log record to stderr
}
\seealso{
This is a \code{\link{log_appender}}, for alternatives, see eg \code{\link{appender_stdout}}, \code{\link{appender_file}}, \code{\link{appender_tee}}, \code{\link{appender_slack}}, \code{\link{appender_pushbullet}}, \code{\link{appender_telegram}}, \code{\link{appender_syslog}}, \code{\link{appender_kinesis}} and \code{\link{appender_async}} for evaluate any \code{\link{log_appender}} function in a background process.
}
logger/man/figures/ 0000755 0001762 0000144 00000000000 13406263114 013750 5 ustar ligges users logger/man/figures/colors.png 0000644 0001762 0000144 00000122244 13375502204 015765 0 ustar ligges users PNG
IHDR k ־[ sBIT|d tEXtSoftware gnome-screenshot> IDATxw|հҪ.B Qۘv=N\8Η:kv)nqLPTP]3B ] h̙sϜsst(((((((((;9sT*f@MAAAAAAADljZ Q5u_?wrdY0AHLH8,)(((((((|3X++-㲅aPdYfâw
}3qI%ҹV_:+~v#c+>768ї33s2c bomٶ Y#b7K7~Ίg$K' 2Ng{+
Y0\.xᇱ^ tziNװ*p"24{wWh&G7`gk)GrDJXf/dμ>~e֕.``6