11context(" Appender" )
22
33
4- x <- LogEvent $ new(
4+ event <- LogEvent $ new(
55 logger = Logger $ new(" dummy" ),
66 level = 200L ,
77 timestamp = structure(1541175573.9308 , class = c(" POSIXct" , " POSIXt" )),
@@ -15,7 +15,7 @@ x <- LogEvent$new(
1515# Appender --------------------------------------------------------------------
1616test_that(" Appender: $append() works" , {
1717 app <- Appender $ new()
18- expect_match(app $ append(x ), " foo bar" )
18+ expect_match(app $ append(event ), " foo bar" )
1919})
2020
2121
@@ -42,8 +42,8 @@ test_that("AppenderFile: logging with LayoutFormat", {
4242 on.exit(unlink(tf ))
4343
4444 app <- AppenderFile $ new(file = tf )
45- app $ append(x )
46- app $ append(x )
45+ app $ append(event )
46+ app $ append(event )
4747 res <- readLines(tf )
4848 expect_true(grepl(" foo" , res [[1 ]]))
4949 expect_true(grepl(" bar" , res [[2 ]]))
@@ -56,10 +56,10 @@ test_that("AppenderFile: logging with LayoutJson", {
5656 on.exit(unlink(tf ))
5757
5858 app <- AppenderFile $ new(file = tf , layout = LayoutJson $ new())
59- app $ append(x )
60- app $ append(x )
59+ app $ append(event )
60+ app $ append(event )
6161 tres <- read_json_lines(tf )
62- eres <- data.table :: rbindlist(list (x $ values , x $ values ))
62+ eres <- data.table :: rbindlist(list (event $ values , event $ values ))
6363
6464 expect_identical(tres [[" level" ]], eres [[" level" ]])
6565 expect_identical(tres [[" msg" ]], eres [[" msg" ]])
@@ -143,7 +143,7 @@ test_that("AppenderFile: creates empty log file on init", {
143143 tf <- tempfile()
144144 on.exit(unlink(tf ))
145145
146- app <- AppenderFile $ new(file = file.path( tf ) )
146+ app <- AppenderFile $ new(file = tf )
147147
148148 lg <-
149149 get_logger(" lgr/testAppenderFileCreatesEmptyLogFile" )$
@@ -152,6 +152,7 @@ test_that("AppenderFile: creates empty log file on init", {
152152
153153 lg $ fatal(" foo" , foo = " bar" )
154154
155+ res <- readLines(tf )
155156 expect_match(res , ' "bar"}' )
156157})
157158
@@ -166,7 +167,7 @@ test_that("AppenderJson: AppenderFile with LayoutJson$show() and $data() work",
166167 app <- AppenderFile $ new(file = tf , layout = LayoutJson $ new())
167168
168169 for (i in 1 : 10 )
169- app $ append(x )
170+ app $ append(event )
170171
171172 # show shows the correct number of lines
172173 r <- utils :: capture.output(app $ show(n = 3 ))
@@ -185,7 +186,7 @@ test_that("AppenderJson: AppenderFile with LayoutJson$show() and $data() work",
185186test_that(" AppenderConsole: $append() works" , {
186187 app <- AppenderConsole $ new()
187188 expect_match(
188- capture.output(app $ append(x )),
189+ capture.output(app $ append(event )),
189190 " ERROR.*:19:33.*foo.*bar"
190191 )
191192})
@@ -195,9 +196,9 @@ test_that("AppenderConsole: $append() works", {
195196
196197test_that(" AppenderConsole: $filter() works" , {
197198 app1 <- AppenderConsole $ new()
198- expect_true(app1 $ filter(x ))
199+ expect_true(app1 $ filter(event ))
199200 app1 $ set_filters(list (function (event ) FALSE ))
200- expect_false(app1 $ filter(x ))
201+ expect_false(app1 $ filter(event ))
201202})
202203
203204
0 commit comments