YaBB3::Error::Error - Error log element.


Name

YaBB3::Error::Error - Error log element.


Synopsis

  use YaBB3::Error::Error;
  # Create the error object.
  my $error = new YaBB3::Error::Error(
      $errorLog,
      "The text representation of the error event.",
      'error',                 # Event type.
      {                        # Actions:
          'display'     => 1,  #   Display this error text if DEBUG is set.
          'log-console' => 0,  #   Do not log this error to the console or server log.
          'log-custom'  => 1   #   Log this error to a configured custom log file.
      }
  );


Overview

Class for YaBB3::Error error messages. An error object that can be added to a YaBB3::Error log object. This class is intended to only be used internally by the YaBB3::Error class. Methods are provided to obtain the text message, to display the error to a channel or a log file, or to send the error to a list of email or SMS addresses.


Description

Each instance of this class represents an event of note, like a warning or error, and holds the message text, event type, and a list of actions to perform. The error object is intended to be added to a YaBB3::Error log object, and each error object holds a reference to the error log that contains it.

The interface to this class is intended to only be used by the error log object, and coders should use the error log interface to create, add, and display the error objects in the log.

An error log object can create new error objects using the new() method with the containing error log object, the message text, the event type, and a hash of actions.

Each type is listed in the errorTypes hash, and defines the level or category of severity of the error.

Each action is listed in the actionTypes hash, which enables or disables the performance of a function.


Reference

Use Packages

  YaBB3::Base
  YaBB3::Error

Package Fields

  $VERSION       The package version number as a float.
  \%errorTypes   A hash of valid error types.
                   error         An event that prevents the method from performing it's function.
                   security      A security violation.
                   warning       An incorrect or unwise event that is not an error.
                   database      A failure or flaw in the backing database.
                   suberror      An error internally generated by the error log or error objects.
  \%actionTypes  A hash of valid actions.
                   display       Include the message in the call frame list (only if DEBUG is true).
                   directPrint   Send the error, composed directly as HTML, to the STDOUT.
                   log-custom    Log the error to the configured CUSTOM_FILE file.
                   log-fatal     Log the error to the system server log as a fatal error and die.
                   log-console   Display the error on the console (if run from a console).
                   email         Email the error to the configured list of EMAILS email addresses.
                   sms           Send the error to the configured list of SMS_ADDRESSES.
                   main-display  Use the error message of this error as the title message.

Object Super Classes

  YaBB3::Base
  YaBB3::Error

Instance Variables

/%y3error
The parent YaBB3::Error error log object from which we query configuration parameters.

$msg
The error message text. get_msg

$type
The event type from the errorTypes list.

/%actions
A hash of actions from the actionTypes list. get_actions

Object Methods

new

  /%y3error  A YaBB3::Error object.
  $msg       The error message text.
  /%optArgs  Hash with optional arguments (see below)
    $type      [Opt] The message type.
    /%actions  [Opt] A hash of any actions.
  Returns
  /%         The new object reference.

Create a new YaBB3::Error:Error object, initialized with the given arguments.

toString

  Returns
  $        The error message text.

Return the text representation of this error as a string, which would be the error message.

directPrint

  $date    A timestamp, as returned from time().
  Returns
  $        1

Compose this error into HTML text and print it to STDOUT. A header will be printed before the first error.

logCustom

  $date    A timestamp, as returned from time().
  Returns
  $        1

Compose this error into text and append it to the parent object's log file.

logFatal

  $date    A timestamp, as returned from time().
  Returns
           No return from a final C<die> statement.

Compose this error into text, append it to the server log, and die.

logConsole

  $date    A timestamp, as returned from time().
  Returns
  $        1

Compose this error into text and print it to the console via a warn statement. This is intened to only be used when YaBB3 is run from a console command line.

email

  $date    A timestamp, as returned from time().
  Returns
  $        1

Compose this error into text and send it as email to the parent object's list of email addresses.

sms

  $date    A timestamp, as returned from time().
  Returns
  $        1

Compose this error into text and send it as a message to the parent object's list of Verizon SMS addresses.


ToDo

* email methods * sms methods * document the header and footer methods


Author

Brian Hann (c0bra@users.sourceforge.net) Torsten Mrotz (tmrotz@yabbforum.com)

Copyright ©2000-2005, YaBB 3 Development Team. All Rights Reserved.
You may distribute this module under the terms of YaBB 3.
 YaBB3::Error::Error - Error log element.