Skip to content

Commit

Permalink
CRAN release 2.3.x (#92)
Browse files Browse the repository at this point in the history
* mnt: Change version to 2.3.0

* revert: Enforce collapse on pkgdown (github pages)

* doc: Add sys.envs to NEWS
  • Loading branch information
MEO265 authored Jun 8, 2024
1 parent baa9f14 commit 4b600d9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Description:
the handler message to an 'ndjson' log file.
No change in existing code is necessary to use this package, and should
only require additions to fully leverage the power of the logging system.
Version: 2.2.2.9999
Version: 2.3.0
Authors@R: c(
person("Matthias", "Ollech", role = c("cre", "aut"), email = "[email protected]"),
person("Ryan", "Price", role = c("fnd", "aut"))
Expand Down
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# loggit2 (development version)
# loggit2 2.3.0

## Breaking Changes
* Custom `sanitizer`s and `unsanitizer`s are no longer supported. This decision was made because no active user is known,
Expand All @@ -17,6 +17,7 @@
* All condition log handlers (e.g., `warning()`) allow `NA` for the parameter `.loggit`. If `NA`, the log level set by `set_log_level()` is used
to determine if the condition should be logged. This is the new default behavior, but since the default log level is `"DEBUG"`, this should not change the behavior of existing code.
* All `set_*` functions now return the previous value of the setting.
* The default settings can now be controlled by the system environment variables `FILE_LOGGIT2`, `TIMESTAMP_LOGGIT2`, `ECHO_LOGGIT2` and `LEVEL_LOGGIT2`.

## Bugfixes
* `read_logs()` now correctly reads empty character values `""`, as in `{"key": ""}`.
Expand Down
6 changes: 3 additions & 3 deletions vignettes/articles/fork.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ loggit::stop("This is an error")
#> Error in loggit::stop("This is an error"): This is an error
```
In `{loggit2}`, each condition handler shows the same call as its base equivalent.
```{r, error = TRUE, collapse = TRUE}
```{r, error = TRUE}
base::message("This is another message")
loggit2::message("This is another message")
Expand All @@ -58,7 +58,7 @@ In `{loggit}`, there are no "condition log handlers" (i.e., functions that work
write to the log) for `base::stopifnot()`. This makes the migration of existing code (without logs) unnecessarily complicated.

In `loggit2`, this has been added:
```{r, error = TRUE, collapse = TRUE}
```{r, error = TRUE}
base::stopifnot("TRUE is not true" = TRUE, "This is an error" = 3L < 1L, "This is another error" = FALSE)
loggit2::stopifnot("TRUE is not true" = TRUE, "This is an error" = 3L < 1L, "This is another error" = FALSE)
```
Expand Down Expand Up @@ -102,7 +102,7 @@ f()
```

In `{loggit2}`, each condition handler shows the same call as its `{base}` equivalent.
```{r, error = TRUE, collapse = TRUE}
```{r, error = TRUE}
f <- function() {
base::message("This is another message")
base::warning("This is another warning")
Expand Down
8 changes: 4 additions & 4 deletions vignettes/further_configurations.rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ The configuration options of `loggit2` are described below. For details, refer t
The log file can be set either via the environment variable `FILE_LOGGIT2`, the function `set_log_file()`, or the `logfile` argument of the logging functions `loggit()` and `with_loggit()`. The wrappers of the base R condition handler always use the session-wide configuration.


```{r, echo = -1, collapse = TRUE}
```{r, echo = -1}
setwd(tempdir())
old_log <- loggit2::set_logfile(logfile = "logfile.log")
loggit2::loggit(
Expand All @@ -67,7 +67,7 @@ loggit2::set_logfile(old_log)

### Log level
The log level can be set either via the environment variable `LEVEL_LOGGIT2` or the function `set_log_level()`. The `.loggit` argument can also be passed to the wrappers of the base R condition handler to enforce logging (`TRUE`) or suppress it (`FALSE`). The logging function `loggit()` can enforce logging through the `ignore_log_level` argument. `with_loggit()` allows setting a log level for the code block being executed.
```{r, error = TRUE, collapse = TRUE}
```{r, error = TRUE}
old_log_lvl <- loggit2::set_log_level("INFO")
loggit2::message("This message will be logged, since the log level is INFO.")
loggit2::loggit(
Expand Down Expand Up @@ -97,7 +97,7 @@ loggit2::set_log_level(old_log_lvl)

### Echo
Whether log messages should also be output to `stdout` can be controlled via the environment variable `ECHO_LOGGIT2` or the function `set_echo()`. Additionally, all logging functions and wrappers of the base R condition handler allow direct control via the `echo` argument.
```{r, collapse = TRUE}
```{r}
old_echo <- loggit2::set_echo(FALSE)
loggit2::message("This message will not be logged, but it will be output to the console.")
loggit2::message("This message will be logged and output to the console.", echo = TRUE)
Expand All @@ -115,7 +115,7 @@ loggit2::set_echo(old_echo)
### Timestamp format
The format of the timestamp can be controlled via the environment variable `TIMESTAMP_LOGGIT2` or the function `set_timestamp_format()`.

```{r, collapse = TRUE}
```{r}
old_ts <- loggit2::set_timestamp_format("%H:%M:%S")
loggit2::message("This message will be logged with a timestamp in the format HH:MM:SS.")
Expand Down

0 comments on commit 4b600d9

Please sign in to comment.