Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

accesslog.h File Reference

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Functions

void alog_open (char *fname, int use_localtime, int use_markers)
void alog_close (void)
void alog_reopen (void)
void alog_use_localtime (void)
void alog_use_gmtime (void)
void alog (const char *fmt,...) PRINTFLIKE(1


Function Documentation

void alog const char *  fmt,
  ...
 

Referenced by alog_close(), alog_open(), alog_reopen(), bb_alog_sms(), obey_request(), return_reply(), smsbox_req_handle(), and url_result_thread().

void alog_close void   ) 
 

Definition at line 111 of file accesslog.c.

References alog(), file, gwlist_consume(), gwlist_destroy(), gwlist_lock(), gwlist_unlock(), and writers.

Referenced by alog_open(), and main().

00112 {
00113 
00114     if (file != NULL) {
00115         if (markers)
00116             alog("Log ends");
00117         gwlist_lock(writers);
00118         /* wait for writers to complete */
00119         gwlist_consume(writers);
00120         fclose(file);
00121         file = NULL;
00122         gwlist_unlock(writers);
00123         gwlist_destroy(writers, NULL);
00124         writers = NULL;
00125     }
00126 }

Here is the call graph for this function:

void alog_open char *  fname,
int  use_localtime,
int  use_markers
 

Definition at line 129 of file accesslog.c.

References alog(), alog_close(), error(), file, filename, gwlist_create, info(), markers, use_localtime, warning(), and writers.

Referenced by init_bearerbox(), init_smsbox(), and init_wapbox().

00130 {
00131     FILE *f;
00132     
00133     use_localtime = use_localtm;
00134     markers = use_markers;
00135 
00136     if (file != NULL) {
00137         warning(0, "Opening an already opened access log");
00138         alog_close();
00139     }
00140     if (strlen(fname) > FILENAME_MAX) {
00141         error(0, "Access Log filename too long: `%s', cannot open.", fname);
00142         return;
00143     }
00144 
00145     if (writers == NULL)
00146         writers = gwlist_create();
00147 
00148     f = fopen(fname, "a");
00149     if (f == NULL) {
00150         error(errno, "Couldn't open logfile `%s'.", fname);
00151         return;
00152     }
00153     file = f;
00154     strcpy(filename, fname);
00155     info(0, "Started access logfile `%s'.", filename);
00156     if (markers)
00157         alog("Log begins");
00158 }

Here is the call graph for this function:

void alog_reopen void   ) 
 

Definition at line 85 of file accesslog.c.

References alog(), error(), file, filename, gwlist_consume(), gwlist_lock(), gwlist_unlock(), and writers.

Referenced by main(), and signal_handler().

00086 {
00087     if (file == NULL)
00088     return;
00089 
00090     if (markers)
00091         alog("Log ends");
00092 
00093     gwlist_lock(writers);
00094     /* wait for writers to complete */
00095     gwlist_consume(writers);
00096 
00097     fclose(file);
00098     file = fopen(filename, "a");
00099 
00100     gwlist_unlock(writers);
00101 
00102     if (file == NULL) {
00103         error(errno, "Couldn't re-open access logfile `%s'.", filename);
00104     } 
00105     else if (markers) {
00106         alog("Log begins");
00107     }
00108 }

Here is the call graph for this function:

void alog_use_gmtime void   ) 
 

Definition at line 167 of file accesslog.c.

References use_localtime.

00168 {
00169     use_localtime = 0;
00170 }

void alog_use_localtime void   ) 
 

Definition at line 161 of file accesslog.c.

References use_localtime.

00162 {
00163     use_localtime = 1;
00164 }

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.