This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Changing log()


Martin Hunt wrote:
> log() currently does a subset of what print() and printf() do. It is
> not useful and should be either deprecated and removed or redefined.

log() is equivalent to libc's puts().  It may not be terribly useful,
but I don't see the harm in keeping it around.

> This would require old scripts that still use it to be updated to use
> print() or printf().
> 
> I would like to redefine it to write a message to stderr, instead of
> stdout.
> 
> Why is the new log necessary? Because stdout is often redirected to a
> file (or in the case of relayfs, sent directly there) and important
> messages aren't seen. Of course, warn() could be used, but sometimes
> the message is really informational. For example, you might want to
> periodically print out the number of probes triggered so far.  Or the
> status of a buffer that is filling up. Or prompt the user to select an
> option.

I understand the usage model, but why should this be a redefinition of
log()?  Adding a new function, notify() or info() perhaps, would serve
your need without breaking old scripts.

This may also be the time to consider implementing equivalents to
fputs() and fprintf().  This would allow you to explicitly route output
to stderr, and we could also permit separate files for logging output.
For example, it may be useful to separate text and binary output, or
even have multiple binary output files.


Josh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]