[ Previous ] [ Contents ] [ Index ] [ Next ]

Ns_LogPeriodic

Overview

Log a formatted message not more than once in a specified period

Syntax

    void Ns_LogPeriodic (
      Ns_LogSeverity inSeverity, 
      time_t         inPeriod, 
      time_t         *lasttime,
      long           *count,
      char           *inFormat, 
      ...);

Description

The Ns_LogPeriodic function writes formatted messages to the server log file.  It is similar to the Ns_Log function, except that no matter how often Ns_LogPeriodic is called, it won't log another message until the specified time period has gone by.  It is useful for errors that might occur very frequently, but you don't want that many messages filling up your log file.

The inSeverity argument is the severity level of the message.  Allowable values are:

Notice

Something interesting occurred.

Warning

Maybe something bad occurred.

Error

Something bad occurred.

Fatal

Something extremely bad occurred. The server will shut down after logging this message.

Bug

Something occurred that implies there is a bug in your code.

Debug

If the server is in Debug mode, the message is printed. Debug mode is specified in the [ns/parameters] section of the configuration file. If the server is not in debug mode, the message is not printed.

The inPeriod argument is the minimum time between logs in seconds.

The lasttime argument is the time of the last call.  This value should be initialized to 0 before calling this function the first time.

The count argument is the count of the number of times the function is called between actual log messages so it can output a message like "This message has occurred n times in the last x seconds.  This value should be initialized to 0 before calling this function the first time.

The inFormat argument is a printf-style format string for the message.

Top of Page

[ Previous ] [ Contents ] [ Index ] [ Next ]
Copyright © 1996 America Online, Inc.