For Programmers: Free Programming Magazines  


Home > Archive > Tcl > December 2004 > ftp::Cd error message









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ftp::Cd error message
Richards Noah \(IFR LIT MET\)

2004-12-10, 3:59 pm

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

Michael A. Cleverly

2004-12-29, 3:58 am

On 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
Richards Noah \(IFR LIT MET\)

2004-12-29, 3:59 pm


"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.


Michael A. Cleverly

2004-12-30, 3:59 pm

On Wed, 29 Dec 2004, Richards Noah (IFR LIT MET) wrote:


> "Michael A. Cleverly" <michael@cleverly.com> wrote:
>
[color=darkred]
> 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
Michael Schlenker

2004-12-30, 3:59 pm

Michael 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




Michael Schlenker

2004-12-30, 3:59 pm

Michael 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




Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com