Skip to content

Commit 389d660

Browse files
committed
lint
1 parent c9e0058 commit 389d660

File tree

3 files changed

+24
-29
lines changed

3 files changed

+24
-29
lines changed

R/logger.R

+3-3
Original file line numberDiff line numberDiff line change
@@ -439,7 +439,7 @@ log_trace <- function(..., namespace = NA_character_,
439439
#' log_trace("DONE")
440440
#' }
441441
with_log_threshold <- function(expression, threshold = ERROR, namespace = "global", index = 1) {
442-
old <- log_threshold(threshold, namespace = namespace, index = index)
443-
on.exit(log_threshold(old, namespace = namespace, index = index))
444-
expression
442+
old <- log_threshold(threshold, namespace = namespace, index = index)
443+
on.exit(log_threshold(old, namespace = namespace, index = index))
444+
expression
445445
}

R/utils.R

+15-20
Original file line numberDiff line numberDiff line change
@@ -78,28 +78,23 @@ deparse_to_one_line <- function(x) {
7878
#' fun()
7979
#' catch_base_log(INFO, NA_character_, .topcall = call("funLONG"))
8080
#' }
81-
catch_base_log <- function(
82-
level,
83-
namespace,
84-
.topcall = sys.call(-1),
85-
.topenv = parent.frame()
86-
) {
87-
namespace <- fallback_namespace(namespace)
81+
catch_base_log <- function(level, namespace, .topcall = sys.call(-1), .topenv = parent.frame()) {
82+
namespace <- fallback_namespace(namespace)
8883

89-
old <- log_appender(appender_console, namespace = namespace)
90-
on.exit(log_appender(old, namespace = namespace))
84+
old <- log_appender(appender_console, namespace = namespace)
85+
on.exit(log_appender(old, namespace = namespace))
9186

92-
# catch error, warning or message
93-
capture.output(
94-
log_level(
95-
level = level,
96-
"",
97-
namespace = namespace,
98-
.topcall = .topcall,
99-
.topenv = .topenv
100-
),
101-
type = 'message'
102-
)
87+
# catch error, warning or message
88+
capture.output(
89+
log_level(
90+
level = level,
91+
"",
92+
namespace = namespace,
93+
.topcall = .topcall,
94+
.topenv = .topenv
95+
),
96+
type = "message"
97+
)
10398

10499
}
105100

tests/testthat/test-logger.R

+6-6
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ test_that("providing log_level() args to wrappers diretly is OK", {
149149
})
150150

151151
test_that("setters check inputs", {
152-
expect_snapshot(error = TRUE, {
153-
log_appender(1)
154-
log_formatter(1)
155-
log_layout(1)
156-
log_threshold("x")
157-
})
152+
expect_snapshot(error = TRUE, {
153+
log_appender(1)
154+
log_formatter(1)
155+
log_layout(1)
156+
log_threshold("x")
157+
})
158158
})

0 commit comments

Comments
 (0)