Skip to content

Commit eec1d7c

Browse files
authored
Merge pull request #163 from ropensci/rm_logger
Remove logging
2 parents b5174b0 + 924b833 commit eec1d7c

19 files changed

+59
-259
lines changed

DESCRIPTION

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ Imports:
4141
cli,
4242
desc,
4343
digest,
44-
futile.logger,
4544
knitr,
4645
pkgbuild,
4746
pkgload,

NAMESPACE

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,20 +28,6 @@ export(yml_remove_files)
2828
export(yml_remove_objects)
2929
export(yml_write)
3030
importFrom(desc,desc)
31-
importFrom(futile.logger,INFO)
32-
importFrom(futile.logger,TRACE)
33-
importFrom(futile.logger,appender.console)
34-
importFrom(futile.logger,appender.file)
35-
importFrom(futile.logger,appender.tee)
36-
importFrom(futile.logger,flog.appender)
37-
importFrom(futile.logger,flog.debug)
38-
importFrom(futile.logger,flog.error)
39-
importFrom(futile.logger,flog.fatal)
40-
importFrom(futile.logger,flog.info)
41-
importFrom(futile.logger,flog.logger)
42-
importFrom(futile.logger,flog.threshold)
43-
importFrom(futile.logger,flog.trace)
44-
importFrom(futile.logger,flog.warn)
4531
importFrom(knitr,knit)
4632
importFrom(knitr,spin)
4733
importFrom(rmarkdown,pandoc_available)

NEWS.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
# DataPackageR (development version)
22

3+
## Significant user-facing changes
4+
* Remove functionality for logging to a logfile (#163)
5+
* Remove 'log' argument from package_build() (#163)
6+
7+
## Unchanged
8+
* User still sees same messages, warnings, and errors on the console
9+
* Changes to data objects still automatically added to the data package NEWS.md
10+
* For now, rendered output files still written to inst/extdata/Logfiles
11+
12+
## Maintenance
13+
* Drop dependency on futile.logger package, which has not been updated since 2016.
14+
315
# DataPackageR 0.16.1
416

517
## Minor user-facing improvements

R/build.R

Lines changed: 14 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#'
77
#' @param packageName \code{character} path to package source directory. Defaults to the current path when NULL.
88
#' @param vignettes \code{logical} specify whether to build vignettes. Default FALSE.
9-
#' @param log log level \code{INFO,WARN,DEBUG,FATAL}
109
#' @param deps \code{logical} should we pass data objects into subsequent scripts? Default TRUE
1110
#' @param install \code{logical} automatically install and load the package after building. Default FALSE
1211
#' @param ... additional arguments passed to \code{install.packages} when \code{install=TRUE}.
@@ -15,7 +14,6 @@
1514
#' @importFrom rprojroot is_r_package
1615
#' @importFrom rmarkdown pandoc_available
1716
#' @importFrom yaml read_yaml
18-
#' @importFrom futile.logger flog.logger flog.trace appender.file flog.debug flog.info flog.warn flog.error flog.fatal flog.appender flog.threshold INFO TRACE appender.console appender.tee
1917
#' @importFrom knitr knit spin
2018
#' @details Note that if \code{package_build} returns an error when rendering an \code{.Rmd}
2119
#' internally, but that same \code{.Rmd} can be run successfully manually using \code{rmarkdown::render},
@@ -43,56 +41,45 @@
4341
#' }
4442
package_build <- function(packageName = NULL,
4543
vignettes = FALSE,
46-
log = INFO,
4744
deps = TRUE,
4845
install = FALSE,
4946
...) {
50-
.multilog_setup(LOGFILE = NULL)
51-
# flog.appender(appender.console())
5247
if (is.null(packageName)) {
5348
packageName <- "."
5449
# use normalizePath
5550
package_path <- normalizePath(packageName, winslash = "/")
5651
packageName <- basename(package_path)
5752
# Is this a package root?
5853
if (!is_r_package$find_file() == package_path) {
59-
flog.fatal(paste0(package_path,
60-
" is not an R package root directory"),
61-
name = "console")
62-
stop("exiting", call. = FALSE)
54+
stop(paste(package_path, "is not an R package root directory"))
6355
}
6456
} else {
6557
package_path <- normalizePath(packageName, winslash = "/")
6658
if (!file.exists(package_path)) {
67-
flog.fatal(paste0("Non existent package ", packageName), name = "console")
68-
stop("exiting", call. = FALSE)
59+
stop(paste("Non existent package", packageName))
6960
}
7061
packageName <- basename(package_path)
7162
}
7263
# This should always be a proper name of a directory, either current or a
7364
# subdirectory
7465
tryCatch({is_r_package$find_file(path = package_path)},
7566
error = function(cond){
76-
flog.fatal(paste0(
77-
package_path,
78-
" is not a valid R package directory beneath ",
79-
getwd()
80-
), name = "console")
81-
stop("exiting", call. = FALSE)
67+
stop(
68+
paste(
69+
package_path,
70+
"is not a valid R package directory beneath",
71+
getwd()
72+
)
73+
)
8274
}
8375
)
8476

8577
# Check that directory name matches package name
8678
validate_pkg_name(package_path)
8779

88-
# Return success if we've processed everything
89-
success <-
90-
DataPackageR(arg = package_path, deps = deps)
91-
ifelse(success,
92-
.multilog_trace("DataPackageR succeeded"),
93-
.multilog_warn("DataPackageR failed")
94-
)
95-
.multilog_trace("Building documentation")
80+
# Process everything
81+
DataPackageR(arg = package_path, deps = deps)
82+
9683
local({
9784
on.exit({
9885
if (packageName %in% names(utils::sessionInfo()$otherPkgs)){
@@ -101,7 +88,6 @@ package_build <- function(packageName = NULL,
10188
})
10289
roxygen2::roxygenize(package_path, clean = TRUE)
10390
})
104-
.multilog_trace("Building package")
10591
location <- pkgbuild::build(path = package_path,
10692
dest_path = dirname(package_path),
10793
vignettes = vignettes,
@@ -142,10 +128,8 @@ validate_pkg_name <- function(package_path){
142128
)$get("Package")
143129
path_pkg_name <- basename(package_path)
144130
if (desc_pkg_name != path_pkg_name){
145-
err_msg <- paste("Data package name in DESCRIPTION does not match",
146-
"name of the data package directory")
147-
flog.fatal(err_msg, name = "console")
148-
stop(err_msg, call. = FALSE)
131+
stop(paste("Data package name in DESCRIPTION does not match",
132+
"name of the data package directory"))
149133
}
150134
desc_pkg_name
151135
}

R/digests.R

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121

2222
.compare_digests <- function(old_digest, new_digest) {
2323
# Returns FALSE when any existing data has is changed, new data is added, or
24-
# data is removed, else return TRUE. Use .multilog_trace for all changes since
25-
# this is standard behavior during package re-build, and changes are already
24+
# data is removed, else return TRUE. Changes are already
2625
# output to the console by .qualify_changes()
2726

2827
old_digest[['DataVersion']] <- NULL
@@ -33,23 +32,7 @@
3332
removed <- setdiff(names(old_digest), names(new_digest))
3433
common <- intersect(names(old_digest), names(new_digest))
3534
changed <- common[new_digest[common] != old_digest[common]]
36-
out <- TRUE
37-
for(name in changed){
38-
.multilog_trace(paste(name, "has changed."))
39-
out <- FALSE
40-
}
41-
42-
for(name in removed){
43-
.multilog_trace(paste(name, "was removed."))
44-
out <- FALSE
45-
}
46-
47-
for(name in added){
48-
.multilog_trace(paste(name, "was added."))
49-
out <- FALSE
50-
}
51-
52-
return(out)
35+
length(c(added, removed, changed)) == 0L
5336
}
5437

5538
.combine_digests <- function(new, old) {

R/load_save.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
pkg_path = NULL) {
99
DataVersion <- validate_DataVersion(DataVersion)
1010
.save_digest(new_data_digest, path = pkg_path)
11-
.multilog_trace("Saving to data")
1211
# TODO get the names of each data object and save them separately. Provide a
1312
# function to load all.
1413
for (i in seq_along(object_names)) {

R/logger.R

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)