Commit 4ba9856d authored by Jonathan Mang's avatar Jonathan Mang 💡
Browse files

fix: fixed bug where `feeback` function uses a missing argument for `headless` or `logfile_dir`

parent ff41a431
Package: DIZutils
Title: Utilities for 'DIZ' R Package Development
Version: 0.0.6.9008
Date: 2021-01-25
Version: 0.0.6.9009
Date: 2021-02-01
Authors@R:
c(person(given = "Jonathan M.",
family = "Mang",
......
......@@ -73,7 +73,12 @@ feedback <-
if (isTRUE(ui) ||
(isFALSE(headless) &&
isTRUE(type == "Error") && isFALSE(ui))) {
feedback_to_ui(print_this = print_this, type = type)
feedback_to_ui(
print_this = print_this,
type = type,
logfile_dir = logfile_dir,
headless = headless
)
}
if ((isTRUE(console) && isFALSE(print_this == "")) ||
......@@ -85,7 +90,8 @@ feedback <-
prefix = prefix,
suffix = suffix,
logjs = logjs,
logfile_dir = logfile_dir
logfile_dir = logfile_dir,
headless = headless
)
}
......@@ -95,11 +101,16 @@ feedback <-
# Hint: Everything printed to the console will also
# be printed to the logfile.
if (isTRUE(typeof(ui) == "character")) {
feedback_to_ui(print_this = print_this, type = type)
feedback_to_ui(
print_this = print_this,
type = type,
logfile_dir = logfile_dir,
headless = headless
)
}
}
#' @title Print to the console. Internal use.
#' @title Print to the console. Internal use only.
#' @description Helper function for the feedback function to print
#' stuff to the console. Everything will also be added to the logfile.
#' Internal use. Use the robust 'feedback' function instead.
......@@ -114,7 +125,8 @@ feedback_to_console <-
prefix,
suffix,
logjs,
logfile_dir) {
logfile_dir,
headless) {
if (length(print_this) == 1) {
res <-
feedback_get_formatted_string(
......@@ -128,7 +140,9 @@ feedback_to_console <-
message(res)
# To logjs:
if (isTRUE(logjs)) {
feedback_to_logjs(res)
feedback_to_logjs(print_this = res,
logfile_dir = logfile_dir,
headless = headless)
}
# To logfile:
feedback_to_logfile(
......@@ -154,7 +168,9 @@ feedback_to_console <-
message(res)
# To logjs:
if (isTRUE(logjs)) {
feedback_to_logjs(res)
feedback_to_logjs(print_this = res,
logfile_dir = logfile_dir,
headless = headless)
}
# To logfile:
feedback_to_logfile(
......@@ -338,7 +354,7 @@ feedback_get_formatted_string <-
#' @export
#'
cleanup_old_logfile <- function(logfile_dir) {
logfile_dir <- repair_dir(logfile_dir)
logfile_dir <- clean_path_name(pathname = logfile_dir, remove.slash = FALSE)
path_with_file <- paste0(logfile_dir, "logfile.log")
# Check if logfile.log is already the logfile for this session:
if (isTRUE(file.exists(path_with_file))) {
......
......@@ -37,7 +37,7 @@ my_desc$set_authors(c(
my_desc$del("Maintainer")
# Set the version
my_desc$set_version("0.0.6.9008")
my_desc$set_version("0.0.6.9009")
# The title of your package
my_desc$set(Title = "Utilities for 'DIZ' R Package Development")
......
......@@ -2,7 +2,7 @@
% Please edit documentation in R/feedback.R
\name{feedback_to_console}
\alias{feedback_to_console}
\title{Print to the console. Internal use.}
\title{Print to the console. Internal use only.}
\usage{
feedback_to_console(
print_this,
......@@ -11,7 +11,8 @@ feedback_to_console(
prefix,
suffix,
logjs,
logfile_dir
logfile_dir,
headless
)
}
\arguments{
......@@ -41,6 +42,10 @@ This only makes sense, if the gui is active.}
\item{logfile_dir}{(Optional, String, default: "tempdir()")
The absolute path to folder where the logfile will be stored.}
\item{headless}{(Optional, Boolean, default: TRUE)
Indicating, if the function is run only in the console (headless = TRUE)
or on a GUI frontend (headless = FALSE).}
}
\value{
No return value, called for side effects (see description)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment