Package: Tasked_Logger

## Documentation

Table of Contents
Class Inheritance Tree

## Index

Package: Tasked_Logger

- Goto spec source

# Description

    package Alog.Tasked_Logger is

Tasked Logger instance. Facilities can be attached to this logger instance in order to log to different targets simultaneously. This instance provides task-safe concurrent logging.

# Tasks & Protected

### Instance

- Goto spec in source

(task type)

Entries: Init, Attach_Facility, Attach_Default_Facility, Detach_Facility, Detach_Default_Facility, Facility_Count, Update, Iterate, Attach_Transform, Detach_Transform, Transform_Count, Log_Message, Clear, Shutdown, Set_Except_Handler
Tasked logger instance. The Init discriminant defines whether or not a default 'stdout' (FD facility without logfile set) is attached automatically. Default is 'False'. Set Init to 'True' if you want to make sure minimal stdout logging is possible as soon as a new logger is instantiated. By default exceptions which occur during asynchronous processing are printed to standard error. Use the Set_Except_Handler entry to register a custom exception handler.

# Types

### Facility_Update_Handle

- Goto declaration in source

    type Facility_Update_Handle is not null access
         procedure (Facility_Handle : Facilities.Handle);

Handle to facility update procedure.

### Handle

- Goto declaration in source

    type Handle is access all Instance;

Handle to tasked logger type.

# Subprograms & Entries

### Instance. Init

- Goto spec in source

    Init: Boolean := False)

### Instance. Attach_Facility (abstract)

- Goto spec in source

    entry Attach_Facility (Facility: Facilities.Handle);

Attach a facility to tasked logger instance.

### Instance. Attach_Default_Facility (abstract)

- Goto spec in source

    entry Attach_Default_Facility;

Attach default facility to tasked logger instance.

### Instance. Detach_Facility (abstract)

- Goto spec in source

    entry Detach_Facility (Name: String);

Detach a facility from tasked logger instance.

### Instance. Detach_Default_Facility (abstract)

- Goto spec in source

    entry Detach_Default_Facility;

Detach default facility from tasked logger instance.

### Instance. Facility_Count (abstract)

- Goto spec in source

    entry Facility_Count (Count: out Natural);

Return number of attached facilites.

### Instance. Update (abstract)

- Goto spec in source

    entry Update (Name: String;Process: Facility_Update_Handle);

Update a specific facility identified by 'Name'. Calls the 'Process' procedure to perform the update operation.

### Instance. Iterate (abstract)

- Goto spec in source

    entry Iterate (Process: Facility_Update_Handle);

Call 'Process' for all attached facilities.

### Instance. Attach_Transform (abstract)

- Goto spec in source

    entry Attach_Transform (Transform: Transforms.Handle);

Attach a transform to tasked logger instance.

### Instance. Detach_Transform (abstract)

- Goto spec in source

    entry Detach_Transform (Name: String);

Detach a transform from tasked logger instance.

### Instance. Transform_Count (abstract)

- Goto spec in source

    entry Transform_Count (Count: out Natural);

Return number of attached transforms.

### Instance. Log_Message (abstract)

- Goto spec in source

    entry Log_Message (Source: String := "";Level: Log_Level;Msg: String;Caller: Ada.Task_Identification.Task_Id := Ada.Task_Identification.Null_Task_Id);

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. If an exception occurs, the exception handler procedure is called. If caller is not specified the executing task's ID is used instead. Since Log_Message'Caller can not be used as default parameter the entry checks if the variable is set to 'Null_Task_Id' in the body.

### Instance. Clear (abstract)

- Goto spec in source

    entry Clear;

Clear tasked logger instance. Detach and teardown all attached facilities and transforms and clear any stored exceptions.

### Instance. Shutdown (abstract)

- Goto spec in source

    entry Shutdown;

Explicitly shutdown tasked logger.

### Instance. Set_Except_Handler (abstract)

- Goto spec in source

    entry Set_Except_Handler (Proc: Exceptions.Exception_Handler);

Set custom exception handler procedure.