Dear All I'm logging the stdout and stderr of an R program into two separate files (stderr.txt and stdout.txt) using sink() I would like to append extra information such as "date", "memory usage" etc to every line of output that goes to stdout or stderr.
For example > cat("hello \n") should give output that looks something like: "hello --- Thu Jun 19 18:39:15 2008 | cel_norm_expm | 389.6 Mb used |" instead of just: "hello" I don't want to replace functions like "print", "cat", "stop" and "warning" with my own special functions. Instead, I want to somehow catch the messages that these functions return and alter them before writing to my logging files. Any code that writes output by making calls to cat etc should be completely isolated from the mechanism that is adding this extra diagnostic information. Is this actually possible? I don't really like the idea of rewriting the "cat" function and creating output for stdout from stderr using "kludges" like: > options(error=function(x=geterrmessage()){cat(x)}) Thank you for any help and please ask me to explain my situation in more detail if necessary -- Thomas Allen Department of Biochemistry University of Otago 710 Cumberland street Box 56 Dunedin New Zealand email1: [EMAIL PROTECTED] email2: [EMAIL PROTECTED] Only the insane have strength enough to prosper and only those who prosper can truly judge what is sane ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.