cgi_log.c File Reference

#include "cgi.h"

Include dependency graph for cgi_log.c:

Go to the source code of this file.

Functions

void SetLoggingLevel (int i)
void LogError (char *c)
void LogMessage (char *c)
void LogStartup (EZSSTREAM *htmlout, char *argv0)
void LogTrx (CGINameValue *data)

Variables

int CGILogLevel = 0
static char * CGIHeaders []


Function Documentation

void LogError char *  c  ) 
 

Definition at line 57 of file cgi_log.c.

References CGIFCLOSE, and CGIFOPEN.

Referenced by CGImain(), DoesFileMatchForm(), EZSReport(), GetSecurityFlags(), ListErrors(), LoadUserDataSQL(), main(), ODBCConnect(), ODBCStart(), PrintFinish(), ShowFormPage(), and TryODBC().

00058  {
00059   FILE * h;
00060   h = CGIFOPEN("logerr.txt","at");
00061   if (h)
00062   {
00063    if (c) fputs(c,h);
00064    else fputs("*NULL*",h);
00065    CGIFCLOSE(h);
00066   }
00067  }

void LogMessage char *  c  ) 
 

Definition at line 69 of file cgi_log.c.

References CGIFCLOSE, CGIFOPEN, and CGILogLevel.

Referenced by CGImain(), LogConnection(), main(), and PrintFinish().

00070  {
00071   FILE * h;
00072   if (CGILogLevel < 1) return;
00073   h = CGIFOPEN("logmsg.txt","at");
00074   if (h)
00075   {
00076    if (c) fputs(c,h);
00077    else fputs("*NULL*",h);
00078    CGIFCLOSE(h);
00079   }
00080  }

void LogStartup EZSSTREAM htmlout,
char *  argv0
 

Definition at line 119 of file cgi_log.c.

References CGIFOPEN, CGIHeaders, CGILogLevel, DeleteNVP(), ExpandLocalPath(), GetEnvironment(), GetField(), GetFieldValue, MAXPATH, NULL, ReadINIFileSection(), and SetLoggingLevel().

Referenced by main().

00120 {
00121  FILE * h;
00122  int i;
00123  char fn[MAXPATH];
00124  CGINameValue* m;
00125 
00126  ExpandLocalPath(argv0,fn,"cgi.ini","");
00127 
00128  m = ReadINIFileSection(fn, "admin",0);
00129 
00130  if (m != NULL)
00131  {
00132   if (GetField(m,"LOGLEVEL"))
00133   {
00134    SetLoggingLevel(atoi(GetFieldValue(m,"LOGLEVEL")));
00135   }
00136   DeleteNVP(m);
00137  }
00138 
00139  if (CGILogLevel < 3) return;
00140  h = CGIFOPEN("logenv.txt","at");
00141  if (!h) return;
00142  fprintf(h,"Starting %s\n",argv0);
00143  fprintf(h,"Environment:\n");
00144 
00145  for(i=0; CGIHeaders[i]; i++)
00146  {
00147   char* y = GetEnvironment(htmlout,CGIHeaders[i]);
00148   if (y) fprintf(h,"%s=%s\n",CGIHeaders[i],y);
00149  }
00150  fprintf(h,"\n\n");
00151  CGIFCLOSE(h);
00152 }

void LogTrx CGINameValue data  ) 
 

Definition at line 154 of file cgi_log.c.

References CGIFCLOSE, CGIFOPEN, and CGILogLevel.

Referenced by main().

00155 {
00156  int i;
00157  FILE * h;
00158  if (CGILogLevel < 2) return;
00159  h = CGIFOPEN("logtrx.txt","at");
00160  if (h)
00161   {
00162    for (i=0;data[i].name;i++)
00163    {
00164     if (!data[i].name[0]) continue;
00165     fprintf(h,"%s=%s\n",data[i].name,data[i].value);
00166    }
00167    fputs("\n",h);
00168    CGIFCLOSE(h);
00169   }
00170 }

void SetLoggingLevel int  i  ) 
 

Definition at line 53 of file cgi_log.c.

References CGILogLevel.

Referenced by LogStartup().

00054  {CGILogLevel = i;}


Variable Documentation

char* CGIHeaders[] [static]
 

Definition at line 82 of file cgi_log.c.

Referenced by LogStartup().

int CGILogLevel = 0
 

Definition at line 50 of file cgi_log.c.



Raosoft, Inc.
Raosoft EZReport, EZSurvey, InterForm, RapidReport, Raosoft, and SurveyWin are registered trademarks of Raosoft, Inc. Page contents © 1996-2007 by Raosoft, Inc. You may use and modify this file for your own use, but may not distribute it or derivative works without the prior written consent of Raosoft, Inc. This software is provided "as is," and Raosoft makes no warranty, express or implied, of fitness for a particular application. Every measure has been taken to anticipate risks inherent to computer networks, but we cannot guarantee safety or reliability of this program in every situation.
Tel: 206-525-4025 (US) Email: raosoft@raosoft.com
http://www.raosoft.com/