Roxen.git / server / modules / logging / memory_logger.pike

version» Context lines:

Roxen.git/server/modules/logging/memory_logger.pike:1:   // This is a roxen module. Copyright © 2011, Roxen IS.      #include <module.h>   inherit "module";    - constant cvs_version = "$Id: memory_logger.pike,v 1.4 2012/03/12 15:36:47 grubba Exp $"; + constant cvs_version = "$Id$";   constant thread_safe = 1;      constant module_type = MODULE_LOGGER;   constant module_name = "Memory logger";   constant module_doc =    "<p>This module prints memory usage information in a log file. "    "The log format contains the following columns:</p>"    "<table>"    "<tr><td>ARR:</td> <td>Array megabytes </td></tr>"    "<tr><td>CLO:</td> <td>Call out megabytes </td></tr>"
Roxen.git/server/modules/logging/memory_logger.pike:70:   }      void schedule()   {    remove_call_out(log_memory);    call_out(log_memory, query("LogInterval"));   }      function log_function;    - void init_log_file() + void end_logger()   { -  if(log_function) -  { -  // Free the old one. -  destruct(function_object(log_function)); +  if (mixed err = catch { +  if (roxen.LogFile logger = +  log_function && function_object (log_function)) { +  logger->close(); +  } +  }) report_error ("While stopping the logger: " + describe_backtrace (err));    log_function = 0;   } -  +  + void init_log_file() + { +  end_logger();    string logfile = query("LogFile");    if(strlen(logfile))    log_function = roxen.LogFile(logfile, query("LogFileCompressor"))->write;   }      void start()   {    init_log_file();    schedule();   }