Package: Active_Logger

## Documentation

Table of Contents
Class Inheritance Tree

## Index

Package: Active_Logger

- Goto spec source

# 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

- Goto declaration in source
- Goto full declaration in source

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

#### Primitive operations:

All_Done

- To API doc
- To spec

Attach_Default_Facility

- To API doc
- To spec

Attach_Facility

- To API doc
- To spec

Attach_Transform

- To API doc
- To spec

Clear

- To API doc
- To spec

Detach_Default_Facility

- To API doc
- To spec

Detach_Facility

- To API doc
- To spec

Detach_Transform

- To API doc
- To spec

Facility_Count

- To API doc
- To spec

Get_Queue_Length

- To API doc
- To spec

Is_Terminated

- To API doc
- To spec

Iterate

- To API doc
- To spec

Log_Message

- To API doc
- To spec

Set_Except_Handler

- To API doc
- To spec

Shutdown

- To API doc
- To spec

Transform_Count

- To API doc
- To spec

Update

- To API doc
- To spec

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

- Goto declaration in source

    type Handle is access all Instance;

Handle to active logger type.

### Shutdown_Helper

- Goto declaration in source
- Goto full declaration in source

    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

- Goto spec in source

    procedure Attach_Facility (Logger: in out Instance;Facility:        Facilities.Handle);

Attach a facility to logger instance.

### Attach_Default_Facility

- Goto spec in source

    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

- Goto spec in source

    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

- Goto spec in source

    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

- Goto spec in source

    function Facility_Count (Logger: Instance) return Natural;

Return number of attached facilites.

### Update

- Goto spec in source

    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

- Goto spec in source

    procedure Iterate (Logger: in out Instance;Process:        Tasked_Logger.Facility_Update_Handle);

Call 'Process' for all attached facilities.

### Attach_Transform

- Goto spec in source

    procedure Attach_Transform (Logger: in out Instance;Transform:        Transforms.Handle);

Attach a transform to logger instance.

### Detach_Transform

- Goto spec in source

    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

- Goto spec in source

    function Transform_Count (Logger: Instance) return Natural;

Return number of attached transforms.

### Clear

- Goto spec in source

    procedure Clear (Logger: in out Instance);

Clear logger instance. Detach and teardown all attached facilities and transforms.

### Log_Message

- Goto spec in source

    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

- Goto spec in source

    function Get_Queue_Length (Logger: Instance) return Natural;

Returns the number of currently queued log messages.

### Shutdown

- Goto spec in source

    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

- Goto spec in source

    function Is_Terminated (Logger: Instance) return Boolean;

Returns True if active logger shutdown sequence is complete.

### All_Done

- Goto spec in source

    procedure All_Done (Logger: in out Instance);

This procedure blocks until all queued logging requests have been consumed.

### Set_Except_Handler

- Goto spec in source

    procedure Set_Except_Handler (Logger: Instance;Proc: Exceptions.Exception_Handler);

Set custom exception handler procedure.