Branch: Tag:

2015-10-15

2015-10-15 11:54:45 by Marcus Agehall <agehall@roxen.com>

Added settings for JS logger endpoints.

5:   // @appears Configuration   //! A site's main configuration    - constant cvs_version = "$Id: configuration.pike,v 1.722 2012/01/26 09:56:42 jonasw Exp $"; + constant cvs_version = "$Id$";   #include <module.h>   #include <module_constants.h>   #include <roxen.h>
720:    }       if (!asynch) stop_all_modules_mutex->lock (1); +  destruct(cfg_js_logger);   }      string|array(string) type_from_filename( string file, int|void to,
4656:      DataCache datacache;    + // Handle changes in js logger endpoints + void js_log_endpoint_cb(object v) { +  if (!cfg_js_logger) return; +  +  array new_endpoints = v->query(); +  array old_endpoints = cfg_js_logger->get_bound_ports(); +  +  multiset obsolete = (multiset)old_endpoints; +  +  // Bind any new ports +  foreach(new_endpoints, string ep) { +  if (!ep || (ep == "")) continue; +  ep = roxen_path(ep); +  if (!obsolete[ep]) { +  cfg_js_logger->bind(ep); +  } +  obsolete[ep] = 0; +  } +  +  foreach((array)obsolete, string ep) { +  if (!ep || (ep == "")) continue; +  cfg_js_logger->unbind(ep); +  } + } +    protected void create()   {    if (!name) error ("Configuration name not set through bootstrap_info.\n"); -  +  +  cfg_js_logger = ConfigurationLogger(([ ]), UNDEFINED); +    // int st = gethrtime();    roxen.add_permission( "Site:"+name, LOC_C(306,"Site")+": "+name );   
5118:    "the access counter log."),    0, lambda(){ return !query("Log");});    +  defvar("JSLogEndpoints", ({ "$LOGDIR/" + Roxen.short_name(name) + ".jslog" }), +  DLOCALE(0, "Logging: JS Logging endpoints"), TYPE_STRING_LIST, +  DLOCALE(0, "Socket paths and/or IP:ports to bind for log output from this configuration")) +  ->add_changed_callback(js_log_endpoint_cb); +     defvar("Domain", roxen.get_domain(), DLOCALE(34, "Domain"),    TYPE_STRING|VAR_PUBLIC|VAR_NO_DEFAULT,    DLOCALE(35, "The domain name of the server. The domain name is used "