EF.Logger
Basic logging services.
TEFLogger class
Central logging service: a singleton (see Instance) that dispatches log messages to the attached endpoints (observers) whenever the message level does not exceed the currently configured LogLevel.
class constructor Create;Creates the singleton Instance.
class destructor Destroy;Destroys the singleton Instance.
procedure AfterConstruction;Sets the log level to its default value.
property MacroExpansionEngine: TEFMacroExpansionEngine read FMacroExpansionEngine;The macro expansion engine set by the last Configure call. It is only valid while endpoints are processing the '{ConfigChanged}' notification.
procedure Configure(const AConfig: TEFTree;Applies the given configuration: reads the log level from the 'Level' node (accepting 'low', 'medium', 'high', 'detailed', 'debug' or an integer), then notifies observers so that endpoints can reconfigure themselves against AConfig and AMacroExpansionEngine.
property LogLevel: Integer read FLogLevel write FLogLevel;Gets or sets the current log level. Messages logged with a level higher than this value are discarded.
procedure Log(const AString: string;Logs AString if ALogLevel does not exceed the current LogLevel, by notifying all attached endpoints.
procedure LogLow(const AString: string);Logs AString at the LOG_LOW level.
procedure LogMedium(const AString: string);Logs AString at the LOG_MEDIUM level.
procedure LogHigh(const AString: string);Logs AString at the LOG_HIGH level.
procedure LogDetailed(const AString: string);Logs AString at the LOG_DETAILED level.
procedure LogDebug(const AString: string);Logs AString at the LOG_DEBUG level.
procedure LogFmt(const AString: string;Logs a message built by formatting AString with AParams (see System.SysUtils.Format) at the specified log level.
TEFLogEndpoint class
Abstract base class for logging endpoints. An endpoint attaches itself as an observer of the logger's Instance and writes each notified message to a concrete destination (see the overridden DoLog). Descendants implement the actual output (for example a text file).
procedure AfterConstruction;Attaches this endpoint as an observer of the logger's Instance.
destructor Destroy;Detaches this endpoint from the logger's Instance.
procedure UpdateObserver(const ASubject: IEFSubject;Handles logger notifications: reconfigures the endpoint on '{ConfigChanged}', otherwise writes the context string through DoLog (messages containing 'PASSWORD' are skipped).
