Skip to content

Commit e6ae949

Browse files
committed
doc
1 parent 2791514 commit e6ae949

File tree

1 file changed

+53
-46
lines changed

1 file changed

+53
-46
lines changed

R/logger_config.R

Lines changed: 53 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,9 @@
1-
#' Create logger configs
1+
#' Logger Configuration Objects
22
#'
3-
#' Coerce any supported \R object to a `logger_config` object. You usually do
4-
#' not have to call this function directly, as it is automatically
5-
#' invoked by the `config()` method of Loggers (see examples)
3+
#' `logger_config()` and `basic_config()` can be used to directly create
4+
#' objects that can be passed to the `$config()` method of Loggers.
65
#'
7-
#' @param x any \R object. Especially:
8-
#' * A `character` scalar. This can either be the path to a
9-
#' [YAML][https://yaml.org/] file, or directly valid YAML
10-
#' * a list containing the elements `appenders`, `threshold`, `exception_handler`,
11-
#' `propagate` and `filters`. See the section *Fields* in [Logger] for
12-
#' details.
13-
#' * a Logger object, to clone its configuration.
14-
#'
15-
#'
16-
#' @return a logger_config object
17-
#' @export
18-
#'
19-
#' @examples
20-
#' cfg <- "
21-
#' Logger:
22-
#' name: test/blubb
23-
#' threshold: info
24-
#' propagate: false
25-
#' appenders:
26-
#' AppenderFile:
27-
#' file: /tmp/blah.txt
28-
#' "
29-
#' lg$config(as_logger_config(cfg))
30-
#' # but you can just do the following directly
31-
#' lg <- get_logger("test")
32-
#' lg$config(cfg)
33-
#'
34-
as_logger_config <- function(x){
35-
UseMethod("as_logger_config")
36-
}
37-
38-
39-
40-
41-
#' Create a Logger configuration object
42-
#'
43-
#' @param appenders
44-
#' @param threshold
45-
#' @param filters
46-
#' @param exception_handler
47-
#' @param propagate
6+
#' @param appenders,threshold,filters,exception_handler,propagate see [Logger]
487
#'
498
#' @return a `list` with subclass `"logger_config"`
509
#' @export
@@ -81,6 +40,42 @@ logger_config <- function(
8140

8241

8342

43+
#' `as_logger_config()` coerces any supported \R object to a `logger_config`
44+
#' object. You usually do not have to call this function directly, as it is
45+
#' automatically invoked by the `config()` method of Loggers (see examples)
46+
#'
47+
#' @param x any \R object. Especially:
48+
#' * A `character` scalar. This can either be the path to a
49+
#' [YAML][https://yaml.org/] file, or directly valid YAML
50+
#' * a list containing the elements `appenders`, `threshold`, `exception_handler`,
51+
#' `propagate` and `filters`. See the section *Fields* in [Logger] for
52+
#' details.
53+
#' * a Logger object, to clone its configuration.
54+
#'
55+
#' @rdname logger_config
56+
#' @return a logger_config object
57+
#' @export
58+
#'
59+
#' @examples
60+
#' cfg <- "
61+
#' Logger:
62+
#' name: test/blubb
63+
#' threshold: info
64+
#' propagate: false
65+
#' appenders:
66+
#' AppenderFile:
67+
#' file: /tmp/blah.txt
68+
#' "
69+
#' lg$config(as_logger_config(cfg))
70+
#' # but you can just do the following directly
71+
#' lg <- get_logger("test")
72+
#' lg$config(cfg)
73+
#'
74+
as_logger_config <- function(x){
75+
UseMethod("as_logger_config")
76+
}
77+
78+
8479

8580

8681
#' @rdname as_logger_config
@@ -239,8 +234,20 @@ standardize_filters_list <- function(x){
239234

240235

241236

237+
#' Title
238+
#' @rdname logger_config
239+
#' @param file `character` scalar.
240+
#' @param fmt
241+
#' @param fmt_timestamp
242+
#' @param threshold
243+
#' @param appenders
244+
#'
245+
#' @return
246+
#' @export
247+
#'
248+
#' @examples
242249
basic_config = function(
243-
filename,
250+
file,
244251
fmt,
245252
fmt_timestamp,
246253
threshold,

0 commit comments

Comments
 (0)