/[mldonkey]/mldonkey/src/daemon/common/commonOptions.ml
ViewVC logotype

Diff of /mldonkey/src/daemon/common/commonOptions.ml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.84 by spiralvoice, Thu Sep 1 00:04:12 2005 UTC revision 1.85 by spiralvoice, Thu Sep 1 16:30:45 2005 UTC
# Line 1314  let log_size = Line 1314  let log_size =
1314    define_expert_option current_section ["log_size"]    define_expert_option current_section ["log_size"]
1315      "size of log in number of records" int_option 300      "size of log in number of records" int_option 300
1316    
1317    let log_file_size = define_expert_option current_section ["log_file_size"]
1318       "Maximum size of log_file in MB" int_option 2
1319    
1320  let log_file = define_expert_option current_section ["log_file"]  let log_file = define_expert_option current_section ["log_file"]
1321    "The file in which you want mldonkey to log its debug messages. If you    "The file in which you want mldonkey to log its debug messages. If you
1322    set this option, mldonkey will log this info in the file until you use the    set this option, mldonkey will log this info in the file until you use the
1323  'close_log' command. The log file may become very large. You can  'close_log' command. The log file may become very large. You can
1324      also enable logging in a file after startup using the 'log_file' command."      also enable logging in a file after startup using the 'log_file' command."
1325    string_option ""    string_option "mlnet.log"
1326    
1327  let verbosity = define_expert_option current_section ["verbosity"]  let verbosity = define_expert_option current_section ["verbosity"]
1328    "A space-separated list of keywords. Each keyword triggers    "A space-separated list of keywords. Each keyword triggers
# Line 1435  let _ = Line 1438  let _ =
1438    option_hook log_file (fun _ ->    option_hook log_file (fun _ ->
1439        if !!log_file <> "" then        if !!log_file <> "" then
1440          try          try
1441            let oc = open_out !!log_file in            if Sys.file_exists !!log_file then
1442                if (Unix32.getsize !!log_file false)
1443                 > (Int64ops.megabytes !!log_file_size) then begin
1444                  Sys.remove !!log_file;
1445                  lprintf_nl "Logfile %s resetted, bigger than %d MB" !!log_file !!log_file_size
1446                end;
1447              let oc = open_out_gen [Open_creat; Open_wronly; Open_append] 0o644 !!log_file in
1448            lprintf_to_file := true;            lprintf_to_file := true;
1449            if Autoconf.system = "windows" then lprintf "%s" win_message;            if Autoconf.system = "windows" then lprintf "%s" win_message;
1450            lprintf_nl "Logging in %s" !!log_file;            lprintf_nl "Logging in %s" ( Filename.concat file_basedir !!log_file);
1451            log_to_file oc;            log_to_file oc;
1452              lprintf_nl "Started logging..."
1453          with e ->          with e ->
1454              lprintf_nl "Exception %s while opening log file: %s"              lprintf_nl "Exception %s while opening log file: %s"
1455                (Printexc2.to_string e) !!log_file                (Printexc2.to_string e) !!log_file
1456        else        else
1457        if !lprintf_to_file then begin          if !lprintf_to_file then begin
1458            lprintf_to_file := false;            lprintf_to_file := false;
1459            close_log ()            close_log ()
1460          end          end

Legend:
Removed from v.1.84  
changed lines
  Added in v.1.85

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26