NAME

Paraniod::Log::Buffer - Log Buffer Functions

MODULE VERSION

$Id: Buffer.pm,v 0.4 2008/02/27 06:53:00 acorliss Exp $

SYNOPSIS

use Paranoid::Log::Buffer;

$rv = init();
$rv = remove($name);

$rv = log($msgtime, $severity, $message, $name, $facility, $level, $scope,
          $bufferSize);

@entries = dump($name);

REQUIREMENTS

Paranoid::Debug

DESCRIPTION

This module implements named buffers to be used for logging purposes. Each buffer is of a concrete size (definable by the developer) with a max message length of 2KB. Each message is stored with a timestamp. Once the buffer hits the maximun number of entries it begins deleting the oldest messages as the new messages come in.

Buffers are created automatically on the fly, and messages trimmed before being stored.

With the exception of the dump function this module is not meant to be used directly. Paranoid::Log should be your exclusive interface for logging.

When enabling a buffer facility with Paranoid::Log you can add one integral argument to the call. That number defines the size of the ring buffer in terms of number of entries allowed.

NOTE: Buffers are maintained within process memory. If you fork a process from a parent with a ring buffer each copy will maintain its own entries.

FUNCTIONS

init

$rv = init();

For the purposes of this module this function only deletes all ring buffers.

remove

$rv = remove($name);

This function removes the specified buffer from memory. Remember, however, that any subsequent attempts to log to that buffer will cause it to automatically be recreated.

log

$rv = log($msgtime, $severity, $message, $name, $facility, $level, $scope,
          $bufferSize);

This function adds another log message to the named buffer. This is not meant to be used directly. Please use the Paranoid::Log module. bufferSize is optional. It defaults to twenty entries unless otherwise specified.

dump

@entries = dump($name);

This dumps all current entries in the named buffer. Each entry is an array reference to a two-element array. The first element is the timestamp of the message (in UNIX epoch seconds), the second the actual message itself.

SEE ALSO

Paranoid::Log(3)

HISTORY

None as of yet.

AUTHOR/COPYRIGHT

(c) 2005 Arthur Corliss (corliss@digitalmages.com)