"sybilLog"
Handles log files, messages warnings and errors.
Objects can be created by calls of the function sybilLog
:
logObj <- sybilLog(filename)
.
fh
:Object of class file
which is a connection
to a file to print to.
fname
:Object of class "character"
being the name of the file to print to. If set to NA
, no logfile
is used. Default: NA
.
fpath
:Object of class "character"
giving the path to the file mentioned in fname
.
Default: "."
.
fenc
:Object of class "character"
encoding of the log file. Default: ""
.
loglevel
:Object of class "integer"
controlling the amount of details to log: If set to 0
,
nothing will be written to the logfile. If set to > 0
, all
warnings are logged; if set do > 1
, also messages are logged.
If loglevel
is > 2
, the used function call will be printed.
Default: 0
.
verblevel
:Object of class "integer"
controlling the amount of details to log: If set to 0
,
nothing will be written to the standard output connection.
If set to > 0
, all warnings are logged; if set do > 1
, also
messages are logged. Default: 0
.
lastStep
:Object of class "list"
which is a stack, containing character strings describing performed steps.
See also sybilStack
.
lstname
:Object of class "list"
giving the name of the stack in lastStep
.
didFoot
:Object of class "logical"
which is FALSE
, if the footer of the log file is not yet printed,
otherwise TRUE
. This is useful if the function which is logged,
stops unexpected.
didFoot
signature(object = "sybilLog")
:
gets the didFoot
slot.
didFoot<-
signature(object = "sybilLog")
:
sets the didFoot
slot.
fenc
signature(object = "sybilLog")
:
gets the fenc
slot.
fenc<-
signature(object = "sybilLog")
:
sets the fenc
slot.
fh
signature(object = "sybilLog")
:
gets the fh
slot.
fh<-
signature(object = "sybilLog")
:
sets the fh
slot.
fname
signature(object = "sybilLog")
:
gets the fname
slot.
fname<-
signature(object = "sybilLog")
:
sets the fname
slot.
fpath
signature(object = "sybilLog")
:
gets the fpath
slot.
fpath<-
signature(object = "sybilLog")
:
sets the fpath
slot.
loglevel
signature(object = "sybilLog")
:
gets the loglevel
slot.
loglevel<-
signature(object = "sybilLog")
:
sets the loglevel
slot.
lstname
signature(object = "sybilLog")
:
gets the lstname
slot.
verblevel
signature(object = "sybilLog")
:
gets the verblevel
slot.
verblevel<-
signature(object = "sybilLog")
:
sets the verblevel
slot.
logCall
signature(object = "sybilLog")
(nog
):
writes all arguments and values of the function call to be
logged to the log file. Nothing is printed to the standard
output; verblevel
has no meaning here; verblevel
must be > 2
.
nog |
number of generations to go back |
logClose<-
signature(object = "sybilLog")
:
close the connection in slot fh
and set it to NA
.
If slot didFoot
is not TRUE
, it prints a log
comment to the connection in fh
mentioning, that the
logging ended unexpected.
logComment
signature(object = "sybilLog")
(cmt, commentChar
):
add a comment to the log file if loglevel
is > 2
and to
stdout
if verblevel
is > 2
.
cmt |
the comment text |
cmtChar |
a string to prefix cmt ,
default: # |
logError
signature(object = "sybilLog")
(msg, num
):
add an error message to the log file. Returns an object of
class '>sybilError
.
msg |
the error message |
num |
an error number |
logFH
signature(object = "sybilLog")
:
Returns TRUE
, if slot fh
is of class file
, otherwise
FALSE
.
logFoot<-
signature(object = "sybilLog")
:
Print a head for your log file.
logHead
signature(object = "sybilLog")
:
Print a foot for your log file.
logMessage
signature(object = "sybilLog")
:
add a message to the log file if loglevel
is > 1
.
... |
strings pasted to the log file |
logOptimization
signature(object = "sybilLog")
:
(ok, stat, obj, del, i
):
add a row containing results of an optimization to the log file if
loglevel
is > 2
and to stdout
if verblevel
is
> 2
.
opt no. |
(integer) a consecutive number |
ret |
(integer) return value of the used solver |
stat |
(integer) solution status after optimization |
obj value |
(numeric) value of the objective function after optimization |
dir |
if not given, it is a global value of the algorithm (here empty), otherwise the current setting of the direction of optimization |
obj c |
if not given, it is a globel value of the model (here empty), otherwise the current setting of the objective coefficients of the variables given in column ‘flux no.’ |
flux no. |
fluxes (variables) which are considered in the current optimization |
logOptimizationTH
signature(object = "sybilLog")
:
add a row containing a table header for results of an optimization to the
log file if loglevel
is > 2
and to stdout
if
verblevel
is > 2
. This should be used prior
logOptimization
.
logStep<-
signature(object = "sybilLog")
:
(value
):
add a status message to the log file if loglevel
is > 1
,
like “performing step x”.
value |
strings giving the status |
is.na(value)
evaluates to TRUE
, the current process is
assumed to have finished as expected. If verblevel
is > 1
,
“OK
” will be printed on the command line end if
loglevel
is > 1
, “# done step x
” will be
printed to the log file.logWarning
signature(object = "sybilLog")
:
(...
):
add a warning to the log file if loglevel
is > 0
.
... |
strings pastes to the log file |
# NOT RUN {
showClass("sybilLog")
# }
Run the code above in your browser using DataLab