Code Comments
Programming Forum and web based access to our favorite programming groups.I'm trying to suppress some output from ftp::Cd in a script I'm writing. To
do so, I figure I'd put it in a catch block, as seen here:
catch {set rtn [ftp::Cd $serverHandle $directory]}
if {$rtn != 1} {
error "Unable to change to directory $directory"
}
If the ftp::Cd does fail (rtn is set to 0), it prints out an error message (
to standard out, not standard err), regardless of its place inside the catch
block.
Does anybody know whats wrong here/ another way to suppress this output?
Thanks,
-Noah
Post Follow-up to this messageOn Fri, 10 Dec 2004, Richards Noah (IFR LIT MET) wrote:
> I'm trying to suppress some output from ftp::Cd in a script I'm writing.
> To do so, I figure I'd put it in a catch block, as seen here:
>
> catch {set rtn [ftp::Cd $serverHandle $directory]}
> if {$rtn != 1} {
> error "Unable to change to directory $directory"
> }
>
> If the ftp::Cd does fail (rtn is set to 0), it prints out an error
> message (to standard out, not standard err), regardless of its place
> inside the catch block.
>
> Does anybody know whats wrong here/ another way to suppress this output?
ftp::Cd calls ftp::DisplayMsg which in turn calls log::log. With the log
package in tcllib you can customize what levels of severity are logged,
where they're logged to, and how. See:
http://tcllib.sourceforge.net/doc/log.html
You probably want log::lvSupress error.
Michael
Post Follow-up to this message"Michael A. Cleverly" <michael@cleverly.com> wrote in message news:Pine.OSX.4.60.0412281444440.7432@powerbook.cleverly.com... > On Fri, 10 Dec 2004, Richards Noah (IFR LIT MET) wrote: > > > ftp::Cd calls ftp::DisplayMsg which in turn calls log::log. With the log > package in tcllib you can customize what levels of severity are logged, > where they're logged to, and how. See: > > http://tcllib.sourceforge.net/doc/log.html > > You probably want log::lvSupress error. > > Michael Thanks, Michael, that works well! Just for future reference, is this documented somewhere? In the ftp documentation (http://tcllib.sourceforge.net/doc/ftp-docs/index.html) it meantions that ftp::VERBOSE and ftp::DEBUG control the output, but neither of these will stop the error output. From what I can see, there is no mention of the use of log. Is there someplace else that this is documented (that you know of)? Also, is this behavior typical of tcllib packages? Thanks for your help.
Post Follow-up to this messageOn Wed, 29 Dec 2004, Richards Noah (IFR LIT MET) wrote: > "Michael A. Cleverly" <michael@cleverly.com> wrote: > > Thanks, Michael, that works well! Just for future reference, is this > documented somewhere? In the ftp documentation > (http://tcllib.sourceforge.net/doc/ftp-docs/index.html) it meantions > that ftp::VERBOSE and ftp::DEBUG control the output, but neither of > these will stop the error output. From what I can see, there is no > mention of the use of log. Is there someplace else that this is > documented (that you know of)? Also, is this behavior typical of tcllib > packages? Thanks for your help. I think more than just the ftp packages use log::log to log output, but without grep'ing through the source, I'm not sure exactly which ones. Since it's apparently not documented in the man page for the ftp package, I'm guessing it might ob the Wiki somewhere (or I picked up on it reading through the ftp source some time back). Not sure where I learned it now, to be honest. :-) We should submit an updated ftp man page to the tcllib project... Michael
Post Follow-up to this messageMichael A. Cleverly schrieb: > On Wed, 29 Dec 2004, Richards Noah (IFR LIT MET) wrote: > > > > > > > I think more than just the ftp packages use log::log to log output, but > without grep'ing through the source, I'm not sure exactly which ones. > Since it's apparently not documented in the man page for the ftp > package, I'm guessing it might ob the Wiki somewhere (or I picked up on > it reading through the ftp source some time back). Not sure where I > learned it now, to be honest. :-) > > We should submit an updated ftp man page to the tcllib project... Most of the server or client packages in tcllib use one of the log or logger packages to provide log messages. The modules that Andreas Kupries mantains mostly use log (as he is the author of log), some of the others use log or logger, based on personal preference. I prefer logger for example (but I'm biased as co-maintainer of the logger module). Perhaps there should be a general guidline or coding advice for tcllib packages how logging should be handled in general, as it is a common problem and most modules could use it. At the moment its more or less the decision of the module owner. This raises the dependency question, do we want more dependencies inside tcllib? Michael
Post Follow-up to this messageMichael A. Cleverly schrieb: > On Wed, 29 Dec 2004, Richards Noah (IFR LIT MET) wrote: > > > > > > > I think more than just the ftp packages use log::log to log output, but > without grep'ing through the source, I'm not sure exactly which ones. > Since it's apparently not documented in the man page for the ftp > package, I'm guessing it might ob the Wiki somewhere (or I picked up on > it reading through the ftp source some time back). Not sure where I > learned it now, to be honest. :-) > > We should submit an updated ftp man page to the tcllib project... Most of the server or client packages in tcllib use one of the log or logger packages to provide log messages. The modules that Andreas Kupries mantains mostly use log (as he is the author of log), some of the others use log or logger, based on personal preference. I prefer logger for example (but I'm biased as co-maintainer of the logger module). Perhaps there should be a general guidline or coding advice for tcllib packages how logging should be handled in general, as it is a common problem and most modules could use it. At the moment its more or less the decision of the module owner. This raises the dependency question, do we want more dependencies inside tcllib? Michael
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.