New feature "Log non-essential commands" and --script_log_all_commands

This commit is contained in:
Thomas Schmitt 2013-01-15 10:49:00 +00:00
parent 9d8da6bbc3
commit ce0ff5e4ae
3 changed files with 46 additions and 14 deletions

View File

@ -65,7 +65,7 @@ So here is the output of xorriso-tcltk --help :
------------------------------------------------------------------------ ------------------------------------------------------------------------
Usage: Usage:
/usr/bin/xorriso-tcltk [options] frontend/xorriso-tcltk [options]
Options: Options:
All options must be given with two dashes ("--option") in All options must be given with two dashes ("--option") in
order to distinguish them from any options of the Tcl shell. order to distinguish them from any options of the Tcl shell.
@ -105,9 +105,11 @@ Options:
reply messages and enable this logging. reply messages and enable this logging.
The log lines will be appended. Path "-" means stderr. The log lines will be appended. Path "-" means stderr.
--script_log_file path --script_log_file path
Set a file address for logging of major xorriso commands Set a file address for logging of essential xorriso
and enable this logging. commands and enable this logging.
The log lines will be appended. Path "-" means stderr. The log lines will be appended. Path "-" means stderr.
--script_log_all_commands
With logging of commands log non-essential commands too.
If neither --stdio nor --named_pipes is given, then this script If neither --stdio nor --named_pipes is given, then this script
will try to locate itself in the filesystem and start a xorriso will try to locate itself in the filesystem and start a xorriso

View File

@ -21,7 +21,7 @@
set own_version "1.2.7" set own_version "1.2.7"
# Minimum version of xorriso to be used as backend provess. # Minimum version of xorriso to be used as backend process.
# Older versions of xorriso do not offer commands -msg_op and -launch_frontend # Older versions of xorriso do not offer commands -msg_op and -launch_frontend
set min_xorriso_version "1.2.6" set min_xorriso_version "1.2.6"
@ -68,9 +68,11 @@ proc print_usage {argv0} {
puts stderr " reply messages and enable this logging." puts stderr " reply messages and enable this logging."
puts stderr " The log lines will be appended. Path \"-\" means stderr." puts stderr " The log lines will be appended. Path \"-\" means stderr."
puts stderr " --script_log_file path" puts stderr " --script_log_file path"
puts stderr " Set a file address for logging of major xorriso commands" puts stderr " Set a file address for logging of essential xorriso"
puts stderr " and enable this logging." puts stderr " commands and enable this logging."
puts stderr " The log lines will be appended. Path \"-\" means stderr." puts stderr " The log lines will be appended. Path \"-\" means stderr."
puts stderr " --script_log_all_commands"
puts stderr " With logging of commands log non-essential commands too."
puts stderr "" puts stderr ""
puts stderr "If neither --stdio nor --named_pipes is given, then this script" puts stderr "If neither --stdio nor --named_pipes is given, then this script"
puts stderr "will try to locate itself in the filesystem and start a xorriso" puts stderr "will try to locate itself in the filesystem and start a xorriso"
@ -193,6 +195,9 @@ set cmd_log_target ""
# Whether to log essential commands: 0=off , 1=no extract , 2=with extract # Whether to log essential commands: 0=off , 1=no extract , 2=with extract
set cmd_logging_mode 0 set cmd_logging_mode 0
# Whether to log all commands if cmd_logging_mode is 1: 0=off , 1=on
set cmd_logging_all 0
# The last logged -cd path. Used to prevent redundant logging of -cd. # The last logged -cd path. Used to prevent redundant logging of -cd.
set recent_cd_path "" set recent_cd_path ""
@ -240,6 +245,7 @@ proc send_async_cmd {cmd} {
global cmd_sent cmd_conn debug_logging debug_log_conn global cmd_sent cmd_conn debug_logging debug_log_conn
display_busy 1 display_busy 1
log_command $cmd 0
debug_log_puts \ debug_log_puts \
" ==============================================================" " =============================================================="
@ -270,7 +276,7 @@ proc send_marked_cmd {cmd} {
# Send a command and make it a candidate for the log script # Send a command and make it a candidate for the log script
# #
proc send_loggable_cmd {cmd} { proc send_loggable_cmd {cmd} {
log_command $cmd log_command $cmd 1
send_marked_cmd $cmd send_marked_cmd $cmd
} }
@ -2006,7 +2012,7 @@ proc refresh_avail {} {
set line "n.a." set line "n.a."
reset_highest_cmd_sev reset_highest_cmd_sev
clear_sieve clear_sieve
send_marked_cmd "-tell_media_space" send_loggable_cmd "-tell_media_space"
if {[compare_sev $highest_cmd_sev "FAILURE"] < 0} { if {[compare_sev $highest_cmd_sev "FAILURE"] < 0} {
set ac "" set ac ""
read_sieve "After commit :" read_sieve "After commit :"
@ -3538,7 +3544,7 @@ proc init_gui {} {
# #
proc init_input {} { proc init_input {} {
global borderwidth busy_text_exists xorriso_version debug_logging global borderwidth busy_text_exists xorriso_version debug_logging
global cmd_logging_mode cmd_log_target osirrox_allowed global cmd_logging_mode cmd_log_target osirrox_allowed cmd_logging_all
global .input .input_line1 .xorriso_version .busy .busy_text global .input .input_line1 .xorriso_version .busy .busy_text
global .refresh_state .end_button .cmdline .log_pipes_switch global .refresh_state .end_button .cmdline .log_pipes_switch
@ -3579,6 +3585,10 @@ proc init_input {} {
-command "effectuate_command_logging 0" \ -command "effectuate_command_logging 0" \
-variable cmd_logging_mode \ -variable cmd_logging_mode \
-onvalue 1 -offvalue 0 -onvalue 1 -offvalue 0
$m add checkbutton -label "Log non-essential commands" \
-indicatoron 1 -selectcolor "" \
-variable cmd_logging_all \
-onvalue 1 -offvalue 0
$m add command -label "Set log script address" \ $m add command -label "Set log script address" \
-command "set_log_script_address" -command "set_log_script_address"
$m add separator $m add separator
@ -4539,6 +4549,10 @@ the xorriso state, but only those which set up that state and those which
get sent via the \"Command:\" field. get sent via the \"Command:\" field.
Commands -osirrox and -extract will be logged only as comments. Commands -osirrox and -extract will be logged only as comments.
The \"Log non-essential commands\" switch controls whether all commands
shall be logged if \"Log command script\" is enabled. Commands
-msg_op \"parse\" and -msg_op \"parse_bulk\" will be logged only as comments.
The item \"Set log script address\" pops up a file tree browser window The item \"Set log script address\" pops up a file tree browser window
which asks for the target of appending to script. Address \"-\" means which asks for the target of appending to script. Address \"-\" means
standard error. Else it must not yet exist or be a writable data file. standard error. Else it must not yet exist or be a writable data file.
@ -4815,6 +4829,9 @@ See xorriso command -stream_recording."
burn a data file from hard disk onto the output drive. burn a data file from hard disk onto the output drive.
The address of the disk file is taken from the neighboring text field. The address of the disk file is taken from the neighboring text field.
No input drive may be aquired. (Delete all characters from the field
\"Input drive/image\" and hit Return to give up the input drive.)
The medium in the drive must be blank. The medium in the drive must be blank.
(It is well possible to burn image files to appendable media. But the (It is well possible to burn image files to appendable media. But the
@ -5517,14 +5534,20 @@ proc yell_xorriso_tcltk {} {
# Log a command (if enabled) # Log a command (if enabled)
# #
proc log_command {cmd} { proc log_command {cmd essential} {
global cmd_log_conn cmd_logging_mode recent_cd_path global cmd_log_conn cmd_logging_mode cmd_logging_all recent_cd_path
if {$cmd_logging_mode < 1} {return ""} if {$cmd_logging_mode < 1} {return ""}
if {$essential <= 0} {
if {$cmd_logging_all <= 0} {return ""}
} else {
# Leave logging to non-essential call which will come soon after
if {$cmd_logging_all > 0} {return ""}
}
if {[string first "-cd " $cmd] == 0} { if {[string first "-cd " $cmd] == 0} {
set path [string range $cmd 4 end] set path [string range $cmd 4 end]
if {$path == $recent_cd_path} {return ""} if {$path == $recent_cd_path && $cmd_logging_all <= 0} {return ""}
set recent_cd_path $path set recent_cd_path $path
} }
@ -5539,6 +5562,9 @@ proc log_command {cmd} {
set prefix "# " set prefix "# "
} }
} }
if {[string first "-msg_op parse" $cmd] != -1} {
set prefix "# "
}
puts $cmd_log_conn $prefix$cmd puts $cmd_log_conn $prefix$cmd
flush $cmd_log_conn flush $cmd_log_conn
} }
@ -5713,7 +5739,7 @@ proc escape_newline {text backslash_too} {
proc setup_by_args {argv0 argv} { proc setup_by_args {argv0 argv} {
global cmd_pipe_adr reply_pipe_adr main_window_geometry click_to_focus global cmd_pipe_adr reply_pipe_adr main_window_geometry click_to_focus
global have_bwidget cmd_conn reply_conn geometry stdout stdin global have_bwidget cmd_conn reply_conn geometry stdout stdin
global osirrox_allowed global osirrox_allowed cmd_logging_all
# wish normally eats the -geometry option and puts the result into $geometry # wish normally eats the -geometry option and puts the result into $geometry
catch {set main_window_geometry $geometry} catch {set main_window_geometry $geometry}
@ -5779,6 +5805,10 @@ proc setup_by_args {argv0 argv} {
# postpone actual log start until start_xorriso has been passed # postpone actual log start until start_xorriso has been passed
set script_logging 1 set script_logging 1
} }
if {$opt == "--script_log_all_commands"} {
set ok "1"
set cmd_logging_all 1
}
if {$opt == "--no_extract"} { if {$opt == "--no_extract"} {
set ok "1" set ok "1"
set osirrox_allowed 0 set osirrox_allowed 0

View File

@ -1 +1 @@
#define Xorriso_timestamP "2013.01.14.094419" #define Xorriso_timestamP "2013.01.15.104804"