logFileName: Define the log file name

Description Usage Arguments Details Value Examples

View source: R/logTools.R

Description

logFileName returns path and name of a file for logging events, or sets the global option rete.logfile.

Usage

1
logFileName(fPath, fName, setOption = FALSE)

Arguments

fPath

A path to a log-file directory. If missing the path is set to getwd().

fName

Name of file to which log messages will be appended. If missing, a new filename is generated.

setOption

Whether to set the global option rete.logfile. Defaults to FALSE.

Details

If fPath is missing, the function checks whether getwd() contains a directory called "logs". If yes, log files will be written to that directory, if no, getwd() will be used as the path. This default behaviour also defines the initial log file path and name on loading the package. A single "/" (or "\"), path separator is removed from fPath if present, since the file.path() function will add a path separator which would result in doubling it otherwise. The default file name is structured as "rete_YYY-MM-DD.d.log" where YYY-MM-DD is the value of Sys.Date() and d is an integer that is one larger than the highest integer in a filename structured this way in the fPath directory. Thus the file name is unique. If the requested filename does not end with the extension ".log", that extension is added. If you must have a logfile named with a different extension, you can set it directly via options("rete.logfile") <- <my.special.name>. If setOption is TRUE, the function sets the global option rete.logfile to which logMessage appends log events.

Value

Path and name of a file that can be used to log events.

## @family TBD

## @seealso logMessage ...

Examples

1
2
3
4
5
logFileName()
## Not run: 
logFileName(fPath = "./logs", setOption = TRUE)

## End(Not run)

hyginn/ekplektoR documentation built on May 17, 2019, 9:16 p.m.