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--
22
23package body Alog.Log_Request is
24
25   use Ada.Strings.Unbounded;
26
27   -------------------------------------------------------------------------
28
29   function Create
30     (ID      : Task_Id   := Current_Task;
31      Source  : String    := "";
32      Level   : Log_Level;
33      Message : String)
34      return Instance
35   is
36   begin
37      return Instance'(Caller_ID => ID,
38                       Source    => To_Unbounded_String (Source),
39                       Level     => Level,
40                       Message   => To_Unbounded_String (Message));
41   end Create;
42
43   -------------------------------------------------------------------------
44
45   function Get_Caller_ID (Request : Instance) return Task_Id is
46   begin
47      return Request.Caller_ID;
48   end Get_Caller_ID;
49
50   -------------------------------------------------------------------------
51
52   function Get_Log_Level (Request : Instance) return Log_Level is
53   begin
54      return Request.Level;
55   end Get_Log_Level;
56
57   -------------------------------------------------------------------------
58
59   function Get_Message (Request : Instance) return String is
60   begin
61      return To_String (Request.Message);
62   end Get_Message;
63
64   -------------------------------------------------------------------------
65
66   function Get_Source (Request : Instance) return String is
67   begin
68      return To_String (Request.Source);
69   end Get_Source;
70
71end Alog.Log_Request;
72