Back to index

php5  5.3.10
Functions
wsyslog.c File Reference
#include "php.h"
#include "syslog.h"
#include <stdio.h>
#include <fcntl.h>
#include <process.h>
#include "php_win32_globals.h"
#include "wsyslog.h"

Go to the source code of this file.

Functions

void closelog (void)
void syslog (int priority, const char *message,...)
void openlog (const char *ident, int logopt, int facility)

Function Documentation

void closelog ( void  )

Definition at line 62 of file wsyslog.c.

{
       TSRMLS_FETCH();
       if (PW32G(log_source)) {
              DeregisterEventSource(PW32G(log_source));
              PW32G(log_source) = NULL;
       }
       if (PW32G(log_header)) {
              STR_FREE(PW32G(log_header));
              PW32G(log_header) = NULL;
       }
}

Here is the caller graph for this function:

void openlog ( const char *  ident,
int  logopt,
int  facility 
)

Definition at line 124 of file wsyslog.c.

{
       TSRMLS_FETCH();

       if (PW32G(log_source)) {
              closelog();
       }

       STR_FREE(PW32G(log_header));

       PW32G(log_source) = RegisterEventSource(NULL, "PHP-" PHP_VERSION);
       spprintf(&PW32G(log_header), 0, (logopt & LOG_PID) ? "%s[%d]" : "%s", ident, getpid());
}

Here is the call graph for this function:

Here is the caller graph for this function:

void syslog ( int  priority,
const char *  message,
  ... 
)

Definition at line 81 of file wsyslog.c.

{
       va_list args;
       LPTSTR strs[2];
       unsigned short etype;
       char *tmp = NULL;
       DWORD evid;
       TSRMLS_FETCH();

       /* default event source */
       if (!PW32G(log_source))
              openlog("php", LOG_PID, LOG_SYSLOG);

       switch (priority) {                /* translate UNIX type into NT type */
              case LOG_ALERT:
                     etype = EVENTLOG_ERROR_TYPE;
                     evid = PHP_SYSLOG_ERROR_TYPE;
                     break;
              case LOG_INFO:
                     etype = EVENTLOG_INFORMATION_TYPE;
                     evid = PHP_SYSLOG_INFO_TYPE;
                     break;
              default:
                     etype = EVENTLOG_WARNING_TYPE;
                     evid = PHP_SYSLOG_WARNING_TYPE;
       }
       va_start(args, message);    /* initialize vararg mechanism */
       vspprintf(&tmp, 0, message, args); /* build message */
       strs[0] = PW32G(log_header);       /* write header */
       strs[1] = tmp;                            /* then the message */
       /* report the event */
       ReportEvent(PW32G(log_source), etype, (unsigned short) priority, evid, NULL, 2, 0, strs, NULL);
       va_end(args);
       efree(tmp);
}

Here is the call graph for this function:

Here is the caller graph for this function: