e_log_write: Initialize and print into a log file and to the console

View source: R/e_log_write.R

e_log_writeR Documentation

Initialize and print into a log file and to the console

Description

Initialize and print into a log file and to the console

Usage

e_log_write(
  log_text = NULL,
  log_obj = log_obj,
  i_level = 2,
  sw_init = c(FALSE, TRUE)[1],
  out_path = ".",
  file_prefix = "out"
)

Arguments

log_text

text string to print

log_obj

log_obj object that includes filename, console function, and time_start

i_level

Numbers 1 to 5 corresponding to "DEBUG", "INFO", "WARN", "ERROR", "FATAL" from log4r::loglevel()s

sw_init

TRUE to initilize log file and console logging, FALSE to print text

out_path

out path for log file

file_prefix

filename prefix for log file

Value

log_obj or NULL

Examples

## Not run: 

# initialize log file
log_obj <-
  e_log_write(
    sw_init     = TRUE
  , out_path    = "."
  , file_prefix = "out"
  )
# write log entry
e_log_write(
    log_text    = "Write this message"
  , log_obj     = log_obj
  , i_level     = 2
  )


## End(Not run)

erikerhardt/erikmisc documentation built on April 17, 2025, 10:48 a.m.