File: alog-policy_db.ads

## Documentation

Table of Contents
Class Inheritance Tree

1.     --

2.     --  Copyright (c) 2009,

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.     --

23.     with Alog.MapsTo API docTo specTo body;

25.     --  Logging policy database package. This DB stores logging policies. Policies

26.     --  in the database are used inside the framework for logging decisions.

27.     package Alog.Policy_DBTo API docTo specTo body is

29.        Alog_Default_Level : constant Log_LevelTo API docTo spec := Info;

30.        --  Framework default loglevel.

32.        procedure Set_Default_LoglevelTo API docTo body (LevelTo API docTo body : Log_LevelTo API docTo spec);

33.        --  Set given loglevel as default loglevel.

35.        function Get_Default_LoglevelTo API docTo body return Log_LevelTo API docTo spec;

36.        --  Return current default loglevel.

38.        procedure Set_LoglevelTo API docTo body

39.          (Identifier : String;

40.           LevelTo API docTo body      : Log_LevelTo API docTo spec);

41.        --  Set given loglevel for specified identifier string. If the identifier is

42.        --  already present the loglevel is updated. Identifier strings are

43.        --  case-sensitive.

44.        --

45.        --  Use wildcards to specify a loglevel for a range of identifiers.

46.        --  Identifier hierarchies are separated by dots, the wildcard is '*'. The

47.        --  following example sets a Debug loglevel for all log-identifiers in

48.        --  Foo.Bar (including Foo.Bar).

49.        --

50.        --  Example:

51.        --     Foo.Bar.* = Debug

52.        --

53.        --  Direct matches take precedence over wildcard matches. In the following

54.        --  example the loglevel for identifier 'Foo.Bar' is explicitly set to Info.

55.        --

56.        --  Example:

57.        --     Foo.Bar   = Info

58.        --     Foo.Bar.* = Debug

60.        procedure Set_LoglevelTo API docTo body (IdentifiersTo API docTo body : Maps.Wildcard_Level_MapTo API docTo specTo body);

61.        --  Apply loglevels for identifiers stored in map.

63.        function Get_LoglevelTo API docTo body (Identifier : String) return Log_LevelTo API docTo spec;

64.        --  Return loglevel for given identifier string. Raises No_Ident_Loglevel

65.        --  exception if no entry for given identifier is found (exact match only,

66.        --  no wildcard lookup).

68.        function LookupTo API docTo body (Identifier : String) return Log_LevelTo API docTo spec;

69.        --  Return loglevel for given identifier string. Returns the closest match,

70.        --  if no associated loglevel is found the default loglevel is returned.

72.        procedure ResetTo API docTo body;

73.        --  Reset the logging policy database to the initial state.

75.        function Accept_SrcTo API docTo body

76.          (Identifier : String := "";

77.           LevelTo API docTo body      : Log_LevelTo API docTo spec)

78.           return Boolean;

79.        --  Returns True if the given loglevel is accepted for a source identifier.

80.        --  If no identifier is given, the loglevel is verified against the default

81.        --  loglevel.

83.        function Accept_DstTo API docTo body

84.          (Identifier : String;

85.           LevelTo API docTo body      : Log_LevelTo API docTo spec)

86.           return Boolean;

87.        --  Returns True if the given loglevel is accepted for a destination

88.        --  identifier. If no match for the given identifier is found True is

89.        --  returned.

91.        No_Ident_Loglevel : exception;

92.        --  Will be raised if loglevel is not found for a requested identifier.

94.     end Alog.Policy_DBTo API docTo specTo body;