FACT++  1.0
void log_it ( int  type,
char *  s1,
char *  s2,
int  conn_id 
)

Definition at line 55 of file webServer.c.

References BUFSIZE, dim_print_date_time(), getTime(), LOG, SORRY, sprintf(), web_write(), and WERROR.

Referenced by main(), and sendFile().

56 {
57  char logbuffer[BUFSIZE*2];
58  static char date_buffer[128];
59  static char snd_buffer[BUFSIZE+1]; /* static so zero filled */
60 
61  switch (type) {
62  case WERROR: (void)printf("ERROR: %s:%s exiting pid=%d\n",s1, s2, getpid()); break;
63  case SORRY:
64  (void)sprintf(logbuffer, "<HTML><BODY><H1>webDid: %s %s</H1></BODY></HTML>\r\n", s1, s2);
66  (void)printf("webDid: %s %s\n",s1, s2);
67  getTime(date_buffer);
68  (void)sprintf(snd_buffer,"HTTP/1.1 200 OK\r\nDate: %s\r\nServer: DID/19.7\r\nContent-Length: %d\r\nContent-Type: %s\r\nConnection: close\r\n\r\n",
69  date_buffer, (int)strlen(logbuffer), "text/html");
70  (void)web_write(conn_id,snd_buffer,(int)strlen(snd_buffer));
71  (void)web_write(conn_id,logbuffer,(int)strlen(logbuffer));
72  break;
73  case LOG: (void)printf("INFO: %s:%s:%d\n",s1, s2,conn_id);
74  break;
75  }
76 /*
77  if(type == WERROR || type == SORRY)
78  {
79  sleep(60);
80  exit(3);
81  }
82 */
83 }
void getTime(char *buffer)
Definition: webServer.c:45
#define BUFSIZE
Definition: webServer.c:9
#define WERROR
Definition: webServer.c:10
void web_write()
#define SORRY
Definition: webServer.c:11
int type
void dim_print_date_time()
Definition: utilities.c:134
#define LOG
Definition: webServer.c:12
sprintf(name1,"NewService%d", i)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: