Class DSystemLogger

Inherits from:
Object
Conforms to:
DLogger
Declared in:
DSystemLogger.h

Class Hierarchy

    Object
      |
      +---DSystemLogger

Class Description

The DSystemLogger class implements methods for continuous logging to the system logger. On Unix this will be the syslog deamon. On Win32 there is not an usable logger present. So this class will only be present on Unix.

Example:
#include <stdio.h>
#include "ofc/DSystemLogger.h"
#include "ofc/DLog.h"

int main(int argc, char *argv[])
{
#ifdef HAVE_DSYSTEMLOGGER
  DSystemLogger *logger = [DSystemLogger alloc];
  int            i;

  [logger init :"example" :NO];        // Init the logger with application "example" and logging to stderr

  dlogger(logger);                     // Give tot the base logger the system logger as destination

  dlog(DLOG_ALERT, "Alert!!");         // Log an alert

  for (i = 0; i < 10; i++)             // Add a repeated error message
  {
    dlog(DLOG_ERROR, "Errors");
  }

  dlogmask(DLOG_NOTICE|DLOG_DEBUG);    // Mask some log levels

  dlog(DLOG_WARNING, "Warning..Masked"); // Masked warning
  dlog(DLOG_DEBUG,   "Debug:%d",7);    // Debug message
  dlog(DLOG_NOTICE,  "Notice");        // Notice message

  dlogger(nil);                        // Stop logging via the system logger

  [logger free];                       // Cleanup

  printf("Events succesfully sent to the system logger.\n");
#else
  printf("SystemLogger not present in the library.\n");
#endif

  return 0;
}
Last modified:
09-Aug-2008 (DSystemLogger.h)

Instance Variables

protected int _mask
the (copy of) the mask

Method Index


generated 06-Sep-2008 by ObjcDoc 3.0.0