/usr/share/ada/adainclude/alog/alog-logger.ads is in libalog0.4.1-base-dev 0.4.1-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | --
-- Copyright (c) 2008,
-- Reto Buerki, Adrian-Ken Rueegsegger
--
-- This file is part of Alog.
--
-- Alog is free software; you can redistribute it and/or modify
-- it under the terms of the GNU Lesser General Public License as published
-- by the Free Software Foundation; either version 2.1 of the License, or
-- (at your option) any later version.
--
-- Alog is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU Lesser General Public License for more details.
--
-- You should have received a copy of the GNU Lesser General Public License
-- along with Alog; if not, write to the Free Software
-- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
-- MA 02110-1301 USA
--
with Ada.Finalization;
with Ada.Unchecked_Deallocation;
with Ada.Strings.Unbounded;
with Alog.Facilities;
with Alog.Transforms;
with Alog.Controlled_Map;
-- 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.
package Alog.Logger is
type Instance (Init : Boolean) is tagged limited private;
-- 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.
type Handle is access all Instance;
-- Handle to logger type.
procedure Attach_Facility
(Logger : in out Instance;
Facility : Facilities.Handle);
-- Attach a facility to logger instance.
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.
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.
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.
function Facility_Count (Logger : Instance) return Natural;
-- Return number of attached facilites.
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.
procedure Iterate
(Logger : Instance;
Process : not null access
procedure (Facility_Handle : Facilities.Handle));
-- Call 'Process' for all attached facilities.
procedure Attach_Transform
(Logger : in out Instance;
Transform : Transforms.Handle);
-- Attach a transform to logger instance.
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.
function Transform_Count (Logger : Instance) return Natural;
-- Return number of attached transforms.
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.
procedure Iterate
(Logger : Instance;
Process : not null access
procedure (Transform_Handle : Transforms.Handle));
-- Call 'Process' for all attached transforms.
procedure Clear (L : in out Instance);
-- Clear logger instance. Detach and teardown all attached facilities and
-- transforms.
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.
procedure Free is new Ada.Unchecked_Deallocation
(Object => Facilities.Class,
Name => Facilities.Handle);
-- Free memory allocated by a facility.
procedure Free is new Ada.Unchecked_Deallocation
(Object => Transforms.Class,
Name => Transforms.Handle);
-- Free memory allocated by a transform.
Facility_Not_Found : exception;
-- Will be raised if a requested facility is not found.
Facility_Already_Present : exception;
-- Will be raised if a facility is already present.
Transform_Not_Found : exception;
-- Will be raised if a requested transform is not found.
Transform_Already_Present : exception;
-- Will be raised if a facility is already present. .
Default_Facility_Name : constant String := "__Default_Facility";
private
use Ada.Strings.Unbounded;
use Alog.Facilities;
use Alog.Transforms;
procedure Initialize (Logger : in out Instance);
-- Initialize the logger instance.
procedure Finalize (Logger : in out Instance);
-- Finalize procedure used to cleanup.
package Map_Of_Transforms_Package is new Alog.Controlled_Map
(Key_Type => Unbounded_String,
Element_Type => Transforms.Class,
Element_Handle => Transforms.Handle);
package MOTP renames Map_Of_Transforms_Package;
package Map_Of_Facilities_Package is new Alog.Controlled_Map
(Key_Type => Unbounded_String,
Element_Type => Facilities.Class,
Element_Handle => Facilities.Handle);
package MOFP renames Map_Of_Facilities_Package;
type Instance (Init : Boolean) is new
Ada.Finalization.Limited_Controlled with record
Facilities : MOFP.Map;
-- Attached facilities.
Transforms : MOTP.Map;
-- Attached transforms.
end record;
end Alog.Logger;
|