Changeset 1779


Ignore:
Timestamp:
2000-12-11T12:03:48+13:00 (23 years ago)
Author:
sjboddie
Message:

Implemented LogDateFormat configuration option.

Location:
trunk/gsdl
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/etc/main.cfg

    r1759 r1779  
    1414# turning off EmailEvents and EmailUserEvents will remove any
    1515# reliance on MailServer.
    16 #MailServer mail.cs.waikato.ac.nz
     16#MailServer      mail.cs.waikato.ac.nz
    1717
    1818# Set status to "disabled" if you don't want the Maintenance and
     
    3333usecookies      false
    3434
     35# LogDateFormat sets the format that timestamps will be stored in the usage
     36# log (i.e. if logcgiargs is enabled). It takes the following values:
     37LocalTime: (the default) The local time and date in the form
     38           "Thu Dec  7 23:47:00 NZDT 2000".
     39UTCTime: Coordinated universal time (GMT) in the same format as LocalTime.
     40Absolute: Integer value representing the number of seconds since
     41          00:00:00 1/1/1970 GMT
     42LogDateFormat   LocalTime
     43
    3544# Log any events that Greenstone deems important in
    3645# $GSDLHOME/etc/events.txt.
     
    4251#                  (e.g. someone just built a collection)
    4352# Disabled: Don't log events
    44 LogEvents       AllEvents
     53LogEvents       Disabled
    4554
    4655# Email the maintainer whenever any event occurs. EmailEvents
     
    4857# Note that perl must be installed for EmailEvents or
    4958# EmailUserEvents to work.
    50 EmailEvents     AllEvents
     59EmailEvents     Disabled
    5160
    5261# In some cases it may be appropriate to email the user about a
    5362# certain event (e.g. notification from the collector that a collection
    5463# was built successfully)
    55 EmailUserEvents true
     64EmailUserEvents false
    5665
    5766
  • trunk/gsdl/lib/gsdltimes.cpp

    r1778 r1779  
    117117}
    118118
    119 // returns current date and time formatted like "Thu Dec 7 23:43:38 2000"
     119// returns current date and time formatted like "Thu Dec 7 23:43:38 GMT 2000"
    120120// if ltime is true return value will be expressed in local time, otherwise
    121121// it'll be Coordinated Universal Time (UTC)
     
    123123text_t get_date (bool ltime) {
    124124
    125   char *timestr;
     125  char *timestr = new char[128];
    126126  tm *tm_ptr = NULL;
    127127  time_t t = time(NULL);
     
    130130  if (tm_ptr == NULL) return "";
    131131
    132   strftime (timestr, 128, "%a %b %e %T %Y", tm_ptr);
     132  strftime (timestr, 128, "%a %b %e %T %Z %Y", tm_ptr);
    133133  text_t ret = timestr;
     134  delete timestr;
    134135  return ret;
    135136}
  • trunk/gsdl/src/recpt/receptionist.cpp

    r1778 r1779  
    2929#include "htmlutils.h"
    3030#include "gsdltools.h"
     31#include "gsdltimes.h"
    3132#include "OIDtools.h"
    3233#include <assert.h>
     
    5657  usecookies = false;
    5758  logcgiargs = false;
     59  LogDateFormat = LocalTime;
    5860
    5961  maintainer.clear();
     
    214216    else if (key == "maintainer") configinfo.maintainer = cfgline[0];
    215217    else if (key == "MailServer") configinfo.MailServer = cfgline[0];
     218    else if (key == "LogDateFormat") {
     219      if (cfgline[0] == "UTCTime") configinfo.LogDateFormat = UTCTime;
     220      else if (cfgline[0] == "Absolute") configinfo.LogDateFormat = Absolute;
     221    }
    216222    else if (key == "LogEvents") {
    217223      if (cfgline[0] == "CollectorEvents") configinfo.LogEvents = CollectorEvents;
     
    595601  if (host.empty()) host = gsdl_getenv ("REMOTE_ADDR", fcgienv);
    596602  text_t browser = gsdl_getenv ("HTTP_USER_AGENT", fcgienv);
    597   time_t ttime = time(NULL);
    598603
    599604  cgiargsclass::const_iterator args_here = args.begin();
     
    615620  logstr += " " + host;
    616621  logstr += " [";
    617   logstr += ttime;
     622  if (configinfo.LogDateFormat == UTCTime) {
     623    logstr += get_date (false);
     624  } else if (configinfo.LogDateFormat == Absolute) {
     625    time_t ttime = time(NULL);
     626    logstr += ttime;
     627  } else {
     628    // LocalTime
     629    logstr += get_date (true);
     630  }
    618631  logstr += "] (" + argstr + ") \"";
    619632  logstr += browser;
  • trunk/gsdl/src/recpt/receptionist.h

    r1762 r1779  
    6363
    6464enum events_t {Disabled, CollectorEvents, AllEvents};
     65enum ldformat_t {LocalTime, UTCTime, Absolute};
    6566
    6667struct recptconf {
     
    7879  bool logcgiargs;  // true if we want to log cgi arguments
    7980
     81  ldformat_t LogDateFormat;
     82
    8083  text_t maintainer; // email address of maintainer
    8184  text_t MailServer; // SMTP mail server to use when sending event messages by email
Note: See TracChangeset for help on using the changeset viewer.