Index

Package: Logger

Description

package Alog.Logger is
Logger instance. Facilities can be attached to a logger instance in order to log to different targets simultaneously. A logger provides different helper functions for logging facilities configuration.

Classes

Instance

type Instance (Init : Boolean) is tagged limited private;

Primitive operations:

Attach_Default_Facility
Attach_Facility
Attach_Transform
Detach_Default_Facility
Detach_Facility
Detach_Transform
Facility_Count
Finalize
Initialize (overriding Initialize)
Transform_Count
Logger instance. The Init discriminant defines whether or not a default 'stdout' (FD facility without logfile set) is attached automatically. - Set Init to 'True' if you want to make sure minimal stdout logging is possible as soon as a new logger is instantiated.

Types

Handle

type Handle is access all Instance;
Handle to logger type.

Constants & Global variables

Facility_Not_Found

Facility_Not_Found        : exception;
Will be raised if a requested facility is not found.

Facility_Already_Present

Facility_Already_Present  : exception;
Will be raised if a requested facility is not found.

Transform_Not_Found

Transform_Not_Found       : exception;
Will be raised if a facility is already present.

Transform_Already_Present

Transform_Already_Present : exception;
Will be raised if a requested transform is not found.

Default_Facility_Name (String)

Default_Facility_Name : constant String := "__Default_Facility";

Subprograms & Entries

Attach_Facility

procedure Attach_Facility 
(Logger: in out Instance;
Facility: Facilities.Handle);
Attach a facility to logger instance.

Attach_Default_Facility

procedure Attach_Default_Facility 
(Logger: in out Instance);
Attach default facility with name Default_Facility_Name to logger instance. If the default facility is already attached do nothing.

Detach_Facility

procedure Detach_Facility 
(Logger: in out Instance;
Name: String);
Detach a facility with name 'Name' from logger instance. If the facility is not found a Facility_Not_Found exception is raised.

Detach_Default_Facility

procedure Detach_Default_Facility 
(Logger: in out Instance);
Detach default facility with name Default_Facility_Name from logger instance. If the default facility is not attached do nothing.

Facility_Count

function Facility_Count 
(Logger: Instance) return Natural;
Return number of attached facilites.

Update

procedure Update 
(Logger: Instance;
Name: String;
Process: not null access procedure (Facility_Handle : Facilities.Handle));
Update a specific Facility identified by 'Name'. Call the 'Process' procedure to perform the update operation.

Iterate

procedure Iterate 
(Logger: Instance;
Process: not null access procedure (Facility_Handle : Facilities.Handle));
Call 'Process' for all attached facilities.

Attach_Transform

procedure Attach_Transform 
(Logger: in out Instance;
Transform: Transforms.Handle);
Attach a transform to logger instance.

Detach_Transform

procedure Detach_Transform 
(Logger: in out Instance;
Name: String);
Detach a transform with name 'Name' from logger instance. If the transform is not found a Transform_Not_Found exception is raised.

Transform_Count

function Transform_Count 
(Logger: Instance) return Natural;
Return number of attached transforms.

Update

procedure Update 
(Logger: Instance;
Name: String;
Process: not null access procedure (Transform_Handle : Transforms.Handle));
Update a specific Transform identified by 'Name'. Call the 'Process' procedure to perform the update operation.

Iterate

procedure Iterate 
(Logger: Instance;
Process: not null access procedure (Transform_Handle : Transforms.Handle));
Call 'Process' for all attached transforms.

Clear

procedure Clear 
(L: in out Instance);
Clear logger instance. Detach and teardown all attached facilities and transforms.

Log_Message

procedure Log_Message 
(Logger: Instance;
Source: String := "";
Level: Log_Level;
Msg: String);
Log a message. The Write_Message() procedure of all attached facilities is called. Depending on the Log-Threshold set, the message is logged to different targets (depending on the facilites) automatically. Prior to actually processing the given log message the policy database is inquired if the log message with given source and level should be logged.

Free

procedure Free is new Ada.Unchecked_Deallocation 
(Object => Facilities.Class, Name => Facilities.Handle);
Free memory allocated by a facility.

Free

procedure Free is new Ada.Unchecked_Deallocation 
(Object => Transforms.Class, Name => Transforms.Handle);
Free memory allocated by a transform.