Changeset 1564

Show
Ignore:
Timestamp:
06/17/08 14:42:08 (7 months ago)
Author:
alo
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • cherokee/trunk/ChangeLog

    r1562 r1564  
    112008-06-17  Alvaro Lopez Ortega  <alvaro@alobbs.com> 
     2 
     3        * cherokee/trace.c (cherokee_trace_do_trace): If "time" is added 
     4        to CHEROKEE_TRACE it prints the time and date at the begining of 
     5        each line of the log. 
    26 
    37        * cherokee/thread.c (phase_to_str): It only needed to be compiled 
  • cherokee/trunk/cherokee/trace.c

    r1131 r1564  
    3535        cherokee_buffer_t  modules; 
    3636        cherokee_boolean_t use_syslog; 
     37        cherokee_boolean_t print_time; 
    3738} cherokee_trace_t; 
    3839 
     
    4041static cherokee_trace_t trace = { 
    4142        CHEROKEE_BUF_INIT,  
     43        false, 
    4244        false 
    4345}; 
     
    7678        } 
    7779         
    78         /* Check where to log 
     80        /* Check the special properties 
    7981         */ 
    8082        trace.use_syslog = (strstr (modules->buf, "syslog") != NULL); 
     83        trace.print_time = (strstr (modules->buf, "time") != NULL); 
    8184 
    8285        return ret_ok; 
     
    9194        char               *lentry_end; 
    9295        va_list             args; 
     96        struct tm           now; 
     97        time_t              now_time; 
    9398        cherokee_buffer_t  *trace_modules = &trace.modules; 
    9499        cherokee_boolean_t  do_log        = false; 
     
    137142         */ 
    138143        cherokee_buffer_clean (&entries); 
     144        if (trace.print_time) { 
     145                now_time = time(NULL); 
     146                cherokee_localtime (&now_time, &now); 
     147                cherokee_buffer_add_va (&entries, "[%02d/%02d/%d:%02d:%02d:%02d] ", 
     148                                        now.tm_mday,  
     149                                        now.tm_mon,  
     150                                        now.tm_year + 1900, 
     151                                        now.tm_hour,  
     152                                        now.tm_min,  
     153                                        now.tm_sec); 
     154        } 
     155 
    139156        cherokee_buffer_add_va (&entries, "%18s:%04d (%30s): ", file, line, func); 
    140157 
  • cherokee/trunk/cherokee/util.c

    r1506 r1564  
    4747#ifdef HAVE_SYS_FILIO_H 
    4848# include <sys/filio.h>     /* defines FIONBIO and FIONREAD */ 
    49 #endif 
    50  
    51 #ifdef HAVE_SYS_TIME_H 
    52 # include <sys/time.h> 
    5349#endif 
    5450