11# ' Logger Configuration Objects
22# '
3- # ' `logger_config()` and `basic_config()` can be used to directly create
4- # ' objects that can be passed to the `$config()` method of Loggers.
3+ # ' `logger_config()` is an S3 constructor for `logger_config` objects
4+ # ' that can be passed to the `$config` method of a [Logger]. You
5+ # ' can just pass a normal `list` instead, but using this constructor is
6+ # ' a more formal way that includes additional argument checking.
57# '
6- # ' @param appenders,threshold,filters,exception_handler,propagate see [Logger]
78# '
8- # ' @return a `list` with subclass `"logger_config"`
9+ # ' @param appenders see [Logger]
10+ # ' @param threshold see [Logger]
11+ # ' @param filters see [Logger]
12+ # ' @param exception_handler see [Logger]
13+ # ' @param propagate see [Logger]
14+ # '
15+ # ' @return a `list` with the subclass `"logger_config"`
916# ' @export
1017# '
1118# ' @examples
19+ # ' lg <- get_logger("test")
20+ # '
21+ # ' # explicetely defining logger configurations with logger_config
22+ # '
1223# ' # call without arguments to generate the default configuration
13- # ' cfg <- logger_config()
24+ # ' cfg <- logger_config() # same as the unconfigured state of a Logger
25+ # ' lg$config(cfg)
26+ # '
1427# '
28+ # ' # Creating a logger config form YAML
29+ # ' cfg <- "
30+ # ' Logger:
31+ # ' name: test/blubb
32+ # ' threshold: info
33+ # ' propagate: false
34+ # ' appenders:
35+ # ' AppenderFile:
36+ # ' file: /tmp/blah.txt
37+ # ' "
38+ # ' lg$config(cfg) # calls as_logger_config() internally
1539logger_config <- function (
1640 appenders = list (),
1741 threshold = NULL ,
@@ -46,39 +70,25 @@ logger_config <- function(
4670# '
4771# ' @param x any \R object. Especially:
4872# ' * A `character` scalar. This can either be the path to a
49- # ' [ YAML][https://yaml.org/] file, or directly valid YAML
73+ # ' YAML file or a character scalar containing valid YAML
5074# ' * a list containing the elements `appenders`, `threshold`, `exception_handler`,
5175# ' `propagate` and `filters`. See the section *Fields* in [Logger] for
5276# ' details.
5377# ' * a Logger object, to clone its configuration.
5478# '
5579# ' @rdname logger_config
80+ # ' @seealso \url{https://www.yaml.org/}
5681# ' @return a logger_config object
5782# ' @export
5883# '
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- # '
7484as_logger_config <- function (x ){
7585 UseMethod(" as_logger_config" )
7686}
7787
7888
7989
8090
81- # ' @rdname as_logger_config
91+ # ' @rdname logger_config
8292# ' @export
8393as_logger_config.list <- function (x ){
8494 assert(is.list(x ))
@@ -99,7 +109,7 @@ as_logger_config.list <- function(x){
99109
100110
101111
102- # ' @rdname as_logger_config
112+ # ' @rdname logger_config
103113# ' @export
104114as_logger_config.character <- function (
105115 x
@@ -125,8 +135,8 @@ as_logger_config.character <- function(
125135
126136
127137
128- # ' @param x
129- # ' @rdname as_logger_config
138+ # ' @export
139+ # ' @rdname logger_config
130140as_logger_config.Logger <- function (x ){
131141 logger_config(
132142 appenders = x $ appenders ,
@@ -232,27 +242,3 @@ standardize_filters_list <- function(x){
232242
233243 x
234244}
235-
236-
237-
238- # ' Title
239- # ' @rdname logger_config
240- # ' @param file `character` scalar.
241- # ' @param fmt
242- # ' @param fmt_timestamp
243- # ' @param threshold
244- # ' @param appenders
245- # '
246- # ' @return
247- # ' @export
248- # '
249- # ' @examples
250- basic_config = function (
251- file ,
252- fmt ,
253- fmt_timestamp ,
254- threshold ,
255- appenders
256- ){
257-
258- }
0 commit comments