49 |
open Gettext |
open Gettext |
50 |
open Autoconf |
open Autoconf |
51 |
|
|
52 |
|
let lprintf_nl () = |
53 |
|
lprintf "%s" |
54 |
|
(log_time ()); lprintf_nl2 |
55 |
|
|
56 |
let _s x = _s "DriverCommands" x |
let _s x = _s "DriverCommands" x |
57 |
let _b x = _b "DriverCommands" x |
let _b x = _b "DriverCommands" x |
58 |
|
|
1633 |
strings_of_option auto_commit; |
strings_of_option auto_commit; |
1634 |
strings_of_option create_dir_mask; |
strings_of_option create_dir_mask; |
1635 |
strings_of_option log_file; |
strings_of_option log_file; |
1636 |
|
strings_of_option log_file_size; |
1637 |
strings_of_option log_size; |
strings_of_option log_size; |
1638 |
] |
] |
1639 |
| 6 -> |
| 6 -> |
2765 |
let buf = o.conn_buf in |
let buf = o.conn_buf in |
2766 |
let b = bool_of_string arg in |
let b = bool_of_string arg in |
2767 |
set_logging b; |
set_logging b; |
2768 |
|
if b then |
2769 |
|
begin |
2770 |
|
lprintf_nl () "Enable logging to stdout..."; |
2771 |
|
log_to_file stdout; |
2772 |
|
lprintf_nl () "Logging to stdout..." |
2773 |
|
end |
2774 |
|
else |
2775 |
|
begin |
2776 |
|
lprintf_nl () "Disable logging to stdout..."; |
2777 |
|
close_log (); |
2778 |
|
if !!log_file <> "" then |
2779 |
|
begin |
2780 |
|
let oc = open_out_gen [Open_creat; Open_wronly; Open_append] 0o644 !!log_file in |
2781 |
|
log_to_file oc; |
2782 |
|
lprintf_nl () "Reopened %s" !!log_file |
2783 |
|
end |
2784 |
|
end; |
2785 |
Printf.sprintf (_b "log to stdout %s") |
Printf.sprintf (_b "log to stdout %s") |
2786 |
(if b then _s "enabled" else _s "disabled") |
(if b then _s "enabled" else _s "disabled") |
2787 |
), "<true|false> :\t\t\treactivate log to stdout"; |
), "<true|false> :\t\t\treactivate log to stdout"; |
2823 |
"The two files are now merged" |
"The two files are now merged" |
2824 |
), " <num1> <num2> :\t\t\ttry to swarm downloads from file <num2> (secondary) to file <num1> (primary)"; |
), " <num1> <num2> :\t\t\ttry to swarm downloads from file <num2> (secondary) to file <num1> (primary)"; |
2825 |
|
|
2826 |
"log_file", Arg_one (fun arg o -> |
"open_log", Arg_none (fun o -> |
2827 |
let oc = open_out arg in |
if !!log_file <> "" then |
2828 |
log_to_file oc; |
begin |
2829 |
_s "log started" |
let log = !!log_file in |
2830 |
), "<file> :\t\t\tstart logging in file <file>"; |
CommonOptions.log_file =:= log; |
2831 |
|
Printf.sprintf "opened logfile %s" !!log_file |
2832 |
|
end |
2833 |
|
else |
2834 |
|
Printf.sprintf "works only if log_file is set" |
2835 |
|
), ":\t\t\t\tenable logging to file"; |
2836 |
|
|
2837 |
"close_log", Arg_none (fun o -> |
"close_log", Arg_none (fun o -> |
2838 |
|
lprintf_nl () "Stopped logging..."; |
2839 |
close_log (); |
close_log (); |
2840 |
_s "log stopped" |
_s "log stopped" |
2841 |
), ":\t\t\t\tclose logging to file"; |
), ":\t\t\t\tclose logging to file"; |
2842 |
|
|
2843 |
|
"clear_log", Arg_none (fun o -> |
2844 |
|
if !!log_file <> "" then |
2845 |
|
begin |
2846 |
|
close_log (); |
2847 |
|
let oc = open_out_gen [Open_creat; Open_wronly; Open_trunc] 0o644 !!log_file in |
2848 |
|
log_to_file oc; |
2849 |
|
lprintf_nl () "Cleared %s" !!log_file; |
2850 |
|
Printf.sprintf "Logfile %s cleared" !!log_file |
2851 |
|
end |
2852 |
|
else |
2853 |
|
Printf.sprintf "works only if log_file is set" |
2854 |
|
), ":\t\t\t\tclear log_file"; |
2855 |
|
|
2856 |
"html_mods", Arg_none (fun o -> |
"html_mods", Arg_none (fun o -> |
2857 |
let buf = o.conn_buf in |
let buf = o.conn_buf in |