Index

Package: Active_Logger

Description

package Alog.Active_Logger is
Active Logger instance. This logger is an active object and implements concurrent, asynchronous logging. It provides the same functionality as the 'simple' logger.

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
Get_Queue_Length
Is_Terminated
Set_Except_Handler
Transform_Count
Active logger instance. Incoming messages (via Log_Message) are put into a request queue. This queue is consumed by a logging task. By default exceptions which occur during asynchronous processing are printed to standard error. Use the Set_Except_Handler procedure to register a custom exception handler.

Types

Handle

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

Shutdown_Helper

type Shutdown_Helper (Logger : not null access Instance) is private;
This helper will call Shutdown on the logger given as discriminant when it goes out of scope. This relieves the user from having to excplicitly call shutdown on an instance of Alog active logger when wanting to terminate. Users must make sure to declare any shutdown helper in a smaller scope than the active logger on which the helper supposed to work.

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: in out Instance;
Name: String;
Process: Tasked_Logger.Facility_Update_Handle);
Update a specific Facility identified by 'Name'. Call the 'Process' procedure to perform the update operation.

Iterate

procedure Iterate 
(Logger: in out Instance;
Process: Tasked_Logger.Facility_Update_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.

Clear

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

Log_Message

procedure Log_Message 
(Logger: in out Instance;
Source: String := "";
Level: Log_Level;
Msg: String);
Log the given message asynchronously. The message is put into a log request queue which is continuously consumed by a logging task. This procedure is *safe* to call from protected actions (e.g. from an entry call statement or rendezvous).

Get_Queue_Length

function Get_Queue_Length 
(Logger: Instance) return Natural;
Returns the number of currently queued log messages.

Shutdown

procedure Shutdown 
(Logger: in out Instance;
Flush: Boolean := True);
Shutdown the active logger. This procedure must be called in order for the logger task to be terminated properly. If 'Flush' is set to True the procedure will wait for all queued messages to be logged.

Is_Terminated

function Is_Terminated 
(Logger: Instance) return Boolean;
Returns True if active logger shutdown sequence is complete.

All_Done

procedure All_Done 
(Logger: in out Instance);
This procedure blocks until all queued logging requests have been consumed.

Set_Except_Handler

procedure Set_Except_Handler 
(Logger: Instance;
Proc: Exceptions.Exception_Handler);
Set custom exception handler procedure.