1--
2--  Copyright (c) 2019,
3--  Reto Buerki, Adrian-Ken Rueegsegger
4--
5--  This file is part of Alog.
6--
7--  Alog is free software; you can redistribute it and/or modify
8--  it under the terms of the GNU Lesser General Public License as published
9--  by the Free Software Foundation; either version 2.1 of the License, or
10--  (at your option) any later version.
11--
12--  Alog is distributed in the hope that it will be useful,
13--  but WITHOUT ANY WARRANTY; without even the implied warranty of
14--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15--  GNU Lesser General Public License for more details.
16--
17--  You should have received a copy of the GNU Lesser General Public License
18--  along with Alog; if not, write to the Free Software
19--  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20--  MA  02110-1301  USA
21--
22
23with Alog.Maps;
24
25--  Destination filtering package implements logging policies for facilities.
26package Alog.Dst_Filter is
27
28   procedure Set_Default_Level (Level : Log_Level);
29   --  Set given loglevel as default level.
30
31   function Get_Default_Level return Log_Level;
32   --  Return current default glevel.
33
34   function Get_Loglevel (Identifier : String) return Log_Level;
35   --  Return loglevel for given identifier string. Raises No_Ident_Loglevel
36   --  exception if no entry for given identifier is found (exact match only,
37   --  no wildcard lookup).
38
39   procedure Set_Loglevel
40     (Name  : String;
41      Level : Log_Level);
42   --  Set given loglevel for facility with specified name. If the identifier
43   --  is already present the loglevel is updated. Name strings are
44   --  case-sensitive.
45
46   procedure Set_Loglevel (Names : Maps.Wildcard_Level_Map);
47   --  Apply loglevels for names stored in map.
48
49   procedure Reset;
50   --  Reset the logging policy database to the initial state.
51
52   function Lookup (Name : String) return Log_Level;
53   --  Return loglevel for facility with given name string. If no associated
54   --  loglevel is found, then the default loglevel is returned.
55
56   function Accept_ID
57     (Name  : String;
58      Level : Log_Level)
59      return Boolean;
60   --  Returns True if the given loglevel is accepted for a facility with given
61   --  name. If no match for the given identifier is found, it is compared to
62   --  the default destination filter loglevel.
63
64end Alog.Dst_Filter;
65