Re: [Gbootroot-devel] Verbosity Logging
Brought to you by:
freesource
From: Cristian Ionescu-I. <ci...@ax...> - 2000-08-22 21:04:03
|
On Tue, 22 Aug 2000, Jonathan Rosenbaum wrote: > On Sun, 20 Aug 2000, Cristian Ionescu-Idbohrn wrote: > > > Another thing I'm thinking of is a verbose option which would put more > > progress info into the log file, tell the user where it's placed and leave > > it there on exit. That would help both bug tracebility and also help > > curious guys, like me, underdtand what's going out behind the scens. > > I am glad you brought this up. First I think we should consider using the > sys function found in Yard: > > sub sys { > open(SYS, "@_ 2>&1 |") or die "open on sys(@_) failed: $!"; > while (<SYS>) { > print LOGFILE; > print if $CFG::verbosity > 0; > } > close(SYS) or die "Command failed: @_\nSee logfile for error > message.\n"; > 0; # like system() > } > > package CFG; > > # $verbosity: 1 or 0 > # > # This controls only what is printed to the screen. > # 0 --> only the important messages. > # 1 --> all messages. > # All messages will be written to the log file regardless of the setting. > # > $verbosity = 0; > > The error parts would be modified to feed the users chosen level of > verbosity to a viewable widget. This would be a good way to handle system > calls. We may also consider getting rid of as many sys() as possible and > use Perl functions whenever we can. But one way or the other there should > be a verbosity option which brings up a text widget to show things as they > happen. And perhaps another option which allows the user to log stuff to > a file, ofcourse things could be cut and pasted, too. > > Tell me what you think? This is good. Clean and proper. Error handling is probably one of the more difficult things. That said, this idea is what I think: a. FATAL stops the execution (perl: die) and throws you out b. ERROR stops the execution cleans up and brings you back to some safe, previous stage; keeps as much as possible of the entered data and gives some indication on what the problem is These two cover the verbosity level 0, above. 3. WARM indicates that something didn't work out but the program can continue This would be verbositi level 1, above. 4. INFO would give something like a trace (debug level) Not everything executed is a shell command, so there's need for a function to do that too. Maybe '--verbosity <level>' may be a command line option? Another way to specify it could be some button(s) on the main window? The results can stay in a log file (like it's done now) or showed 'live' in another window. |