## Documentation

Table of Contents
Class Inheritance Tree

1.     --

2.     --  Copyright (c) 2008-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 Ada.Text_IO;

25.     --  File_Descriptor facility. Used to log to a console or file. If no file is

26.     --  specified by a Set_Logfile()-call, console logging is used.

27.     package Alog.Facilities.File_DescriptorTo API docTo specTo body is

29.        type InstanceTo API docTo body is new Alog.Facilities.InstanceTo API docTo specTo body with private;

30.        --  File Descriptor based logging facility.

32.        type Handle is access all InstanceTo API docTo specTo body;

34.        overriding

35.        procedure TeardownTo API docTo body (FacilityTo API docTo body : in out InstanceTo API docTo specTo body);

36.        --  Implementation of Teardown-procedure.

38.        procedure Set_LogfileTo API docTo body

39.          (FacilityTo API docTo body : in out InstanceTo API docTo specTo body;

40.           Path     :        String;

41.           Append   :        Boolean := True);

42.        --  Set logfile to use. If not set, standard output is used for logging.

43.        --  Set Append to False if an existing logfile should be overwritten.

45.        function Get_LogfileTo API docTo body (FacilityTo API docTo body : InstanceTo API docTo specTo body) return Ada.Text_IO.File_Access;

46.        --  Get currently used logfile.

48.        procedure Close_LogfileTo API docTo body

49.          (FacilityTo API docTo body : in out InstanceTo API docTo specTo body;

50.           Remove   :        Boolean := False);

51.        --  Close opened logfile.

53.        Open_File_Error : exception;

54.        --  This exception is raised if an error occurs while trying to open a

55.        --  logfile.

57.     private

59.        overriding

60.        procedure Write

61.          (Facility : InstanceTo API docTo specTo body;

62.           Level    : Log_LevelTo API docTo spec := Info;

63.           Msg      : String);

64.        --  Implementation of the Write procedure for FD.

66.        type InstanceTo API docTo spec is new Alog.Facilities.InstanceTo API docTo specTo body with record

67.           Log_File      : aliased Ada.Text_IO.File_Type;

68.           --  Logfile used for file based logging.

70.           Log_File_Ptr  : Ada.Text_IO.File_Access :=

71.             Ada.Text_IO.Standard_Output;

72.           --  Reference to actual log file. Default is Standard_Output.

74.           Log_File_Name : BS_Path.Bounded_String :=

75.             To_Bounded_String ("none");

76.           --  File name of log file.

77.        end record;

79.     end Alog.Facilities.File_DescriptorTo API docTo specTo body;