DataK - B. THIEURMEL
2014-Oct-07 11:04 UTC
[Rd] [R logs] Help in develop a simply logs package
Hi, With the use of R in production, it is necessary to have a system of logs effective, and light. Package exist as to futile.logger, but it require the additional coding of logs. So it is thus impossible / very difficult to use it with all package them used in the calculation Our idea is to develop one packages global, simple, who would allow to identify all the errors, warning, message generated by the functions stop(), warning() and message() stop as well as by signals and internally code, with log levels configurable later by package, functions... One way is to overwrite temporarily the functions stop(), warning() and message() of base package, but I think is not a good thing, and furthermore, we lose all signals and internally "message"... A good use of options(error) seems to do the perfect job, but only for error... Our problem / question : - At present, how it is possible to have the same features for messages and warnings? (like options(errors)) (I don't find...) - Would new options be possible in a near future R ? - Have there better / other possibilities to handle all the warnings, message of the way which we wish? Hope is clear. Open to any suggestions. Thank you in advance -- Benoit Thieurmel +33 6 69 04 06 11 DataKnowledge 46 rue Amsterdam - 75009 Paris
On 07/10/2014, 7:04 AM, DataK - B. THIEURMEL wrote:> Hi, > > With the use of R in production, it is necessary to have a system of > logs effective, and light. > > Package exist as to futile.logger, but it require the additional coding > of logs. So it is thus impossible / very difficult to use it with all > package them used in the calculation > > Our idea is to develop one packages global, simple, who would allow to > identify all the errors, warning, message generated by the functions > stop(), warning() and message() stop as well as by signals and > internally code, with log levels configurable later by package, > functions... > > One way is to overwrite temporarily the functions stop(), warning() and > message() of base package, but I think is not a good thing, and > furthermore, we lose all signals and internally "message"... > > A good use of options(error) seems to do the perfect job, but only for > error... > > Our problem / question : > - At present, how it is possible to have the same features for messages > and warnings? (like options(errors)) (I don't find...) > - Would new options be possible in a near future R ? > - Have there better / other possibilities to handle all the warnings, > message of the way which we wish? >withCallingHandlers() lets you evaluate expressions with code to catch messages, warnings and errors. I don't know if there's a way to evaluate every expression entered at the console within withCallingHandlers() for an effect like options(error=), but you can certainly write code to read a file and evaluate every expression in it within a withCallingHandlers() call. Duncan Murdoch> Hope is clear. Open to any suggestions. > > Thank you in advance >
On Oct 7, 2014, at 7:04 AM, DataK - B. THIEURMEL <bt at datak.fr> wrote:> > Hi, > > With the use of R in production, it is necessary to have a system of logs effective, and light. > > Package exist as to futile.logger, but it require the additional coding of logs. So it is thus impossible / very difficult to use it with all package them used in the calculation > > Our idea is to develop one packages global, simple, who would allow to identify all the errors, warning, message generated by the functions stop(), warning() and message() stop as well as by signals and internally code, with log levels configurable later by package, functions... > > One way is to overwrite temporarily the functions stop(), warning() and message() of base package, but I think is not a good thing, and furthermore, we lose all signals and internally "message"... > > A good use of options(error) seems to do the perfect job, but only for error... > > Our problem / question : > - At present, how it is possible to have the same features for messages and warnings? (like options(errors)) (I don't find...) > - Would new options be possible in a near future R ? > - Have there better / other possibilities to handle all the warnings, message of the way which we wish? > > Hope is clear. Open to any suggestions. >It really depends on what you're after. If you really mean log as in recording errors/message that go to the console the you can use the console interface API to override WriteConsole and ShowMessage to tie the messages to another place in addition to printing it out. But what is feasible really depends on how you run R in the first place (and on which OS). Cheers, Simon> Thank you in advance > > -- > Benoit Thieurmel > +33 6 69 04 06 11 > > DataKnowledge > 46 rue Amsterdam - 75009 Paris > > ______________________________________________ > R-devel at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel >