Class ALoggedItem

DescriptionHierarchyFieldsMethodsProperties

Unit

Declaration

type ALoggedItem = class(AnException)

Description

This class represents a basic item that can be logged to an instance of ALog. While it is possible to log anything to ALog, by means of ALog.print, classes that descend from ALoggedItem will also update their associated counters when logged, providing a way to track how many of each type of item is logged.

ALoggedItem derives from AnException so that it can be raised as one, if need be. This functionality is often used to raise instances of ALoggedError and ALoggedFatalError after they have been logged.

Hierarchy

Overview

Fields

Protected myCounterName: string;

Methods

Public function init: boolean; override;
Public function shallowCopyFrom(const Other: AnObject): boolean; override;
Public function toString: AnsiString; override;
Public function counterName: string; virtual;

Description

Fields

Protected myCounterName: string;

Stores the name of the log counter to increment when the item is logged

Methods

Public function init: boolean; override;

Initializer

Public function shallowCopyFrom(const Other: AnObject): boolean; override;

Construct a shallow copy of the other object.

This method extends the behavior inherited from AnException.shallowCopyFrom: it calls that method, then checks to see if Other is an instance of ALoggedItem. If so, it copies the value of ALoggedItem.counterName from Other to Self, overwriting the value in Self.

Public function toString: AnsiString; override;

Construct and return a string representation of the item, suitable for printing to a text-based device, such as a console.

This method overrides the behavior inherited from AnException.toString so that only the message part of the class is returned, not its display name.

Public function counterName: string; virtual;

Retrieve the name of the counter that will be incremented when instances of this class are logged to ALog. In the base implementation of ALoggedItem, this counter is named by lgitCounterName and is set to the generic name messages by default.


Generated by PasDoc 0.13.0 on 2015-06-23 19:40:11