The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
library(ptspotter)
#> Loading required package: beepr
#> Loading required package: log4r
#>
#> Attaching package: 'log4r'
#> The following object is masked from 'package:base':
#>
#> debug
#> Loading required package: this.path
#> Registered S3 method overwritten by 'pryr':
#> method from
#> print.bytes Rcpp
Logging is an excellent way to monitor the status of your data pipelines. Please consult the ‘log4r’ documentation for a comprehensive guide to its features.
In order to quickly get up and running with ‘log4r’, there are a few steps to take first. A directory and a logfile are required.
log_file_ops(dir_path = "logs", logfile_nm = "logfile")
#> Logging directory successfully created at 'logs/'
#> Logfile successfully created at 'logs/logfile.txt'
list.files("logs")
#> [1] "logfile.txt"
This will only need to be executed once. Running this line again will throw an error.
Next we need to create the required objects within R to be able to write to the logfile we created. Namely, a file appender and logger objects are needed. This needs to be executed every time you run your programme, so include it within your script.
We can now use the logging functions in ‘log4r’ to begin writing messages to the logfile.
log4r::info(logger = my_logger, message = "Some info")
log4r::warn(logger = my_logger, message = "Some warning")
log4r::error(logger = my_logger, message = "Some error")
# Check the messages are being logged
readLines("logs/logfile.txt")
#> [1] "INFO [2023-08-13 14:42:42] Some info"
#> [2] "WARN [2023-08-13 14:42:42] Some warning"
#> [3] "ERROR [2023-08-13 14:42:42] Some error"
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.