Skip to content

Commit

Permalink
export print methods
Browse files Browse the repository at this point in the history
  • Loading branch information
jmbarbone committed May 22, 2023
1 parent dc578d0 commit cbc31c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 5 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Generated by roxygen2: do not edit by hand

S3method(print,echo_err)
S3method(print,echo_exp)
S3method(print,echo_msg)
S3method(print,echo_out)
S3method(print,echo_wrn)
export(echo)
15 changes: 10 additions & 5 deletions R/echo-classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,32 @@ echo_echo <- function(x, level = "NUL") {
print(x)
}

print.echo_exp <- function(x) {
#' @export
print.echo_exp <- function(x, ...) {
catln(time(), "[EXP] ", x)
}

print.echo_out <- function(x) {
#' @export
print.echo_out <- function(x, ...) {
if (!length(x) || isTRUE(!nzchar(x))) {
return(invisible())
}

catln(paste0(time(), "[OUT] #> ", x, collapse = "\n"))
}

print.echo_msg <- function(x) {
#' @export
print.echo_msg <- function(x, ...) {
cat0(paste0(time(), "[MSG] #> ", x))
}

print.echo_wrn <- function(x) {
#' @export
print.echo_wrn <- function(x, ...) {
catln(paste0(time(), "[WRN] #> ", x))
}

print.echo_err <- function(x) {
#' @export
print.echo_err <- function(x, ...) {
catln(paste0(time(), "[ERR] #> ", x))
}

Expand Down

0 comments on commit cbc31c5

Please sign in to comment.