Package: Logger

## Documentation

Table of Contents
Class Inheritance Tree

## Index

Package: Logger

- Goto spec source

# 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

- Goto declaration in source
- Goto full declaration in source

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

#### Primitive operations:

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

Finalize
Initialize (overriding Initialize)
Instance

- To API doc
- To spec

Iterate

- To API doc
- To spec

Iterate

- To API doc
- To spec

Log_Message

- To API doc
- To spec

Transform_Count

- To API doc
- To spec

Update

- To API doc
- To spec

Update

- To API doc
- To spec

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

- Goto declaration in source

    type Handle is access all Instance;

Handle to logger type.

# Constants & Global variables

### Facility_Not_Found

- Goto declaration in source

    Facility_Not_Found        : exception;

Will be raised if a requested facility is not found.

### Facility_Already_Present

- Goto declaration in source

    Facility_Already_Present  : exception;

Will be raised if a requested facility is not found.

### Transform_Not_Found

- Goto declaration in source

    Transform_Not_Found       : exception;

Will be raised if a facility is already present.

### Transform_Already_Present

- Goto declaration in source

    Transform_Already_Present : exception;

Will be raised if a requested transform is not found.

### Default_Facility_Name

- Goto declaration in source

(String)

    Default_Facility_Name : constant String := "__Default_Facility";

# 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: 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

- Goto spec in source

    procedure Iterate (Logger: Instance;Process: not null access procedure (Facility_Handle : Facilities.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.

### Update

- Goto spec in source

    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

- Goto spec in source

    procedure Iterate (Logger: Instance;Process: not null access procedure (Transform_Handle : Transforms.Handle));

Call 'Process' for all attached transforms.

### Clear

- Goto spec in source

    procedure Clear (L: in out Instance);

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

### Log_Message

- Goto spec in source

    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

- Goto spec in source

    procedure Free is new Ada.Unchecked_Deallocation (Object => Facilities.Class, Name   => Facilities.Handle);

Free memory allocated by a facility.

### Free

- Goto spec in source

    procedure Free is new Ada.Unchecked_Deallocation (Object => Transforms.Class, Name   => Transforms.Handle);

Free memory allocated by a transform.