1. -- 
  2. --  Copyright (c) 2009, 
  3. --  Reto Buerki, Adrian-Ken Rueegsegger 
  4. --  secunet SwissIT AG 
  5. -- 
  6. --  This file is part of Alog. 
  7. -- 
  8. --  Alog is free software; you can redistribute it and/or modify 
  9. --  it under the terms of the GNU Lesser General Public License as published 
  10. --  by the Free Software Foundation; either version 2.1 of the License, or 
  11. --  (at your option) any later version. 
  12. -- 
  13. --  Alog is distributed in the hope that it will be useful, 
  14. --  but WITHOUT ANY WARRANTY; without even the implied warranty of 
  15. --  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
  16. --  GNU Lesser General Public License for more details. 
  17. -- 
  18. --  You should have received a copy of the GNU Lesser General Public License 
  19. --  along with Alog; if not, write to the Free Software 
  20. --  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, 
  21. --  MA  02110-1301  USA 
  22. -- 
  23.  
  24. with Ada.Task_Identification; 
  25. with Ada.Strings.Unbounded; 
  26.  
  27. --  Log request type. Log request objects are used for asynchronous logging and 
  28. --  hold all relevant information of a log request. 
  29. package Alog.Log_Request is 
  30.  
  31.    use Ada.Task_Identification; 
  32.  
  33.    type Instance is tagged private; 
  34.    --  A log request contains all related information to log asynchronously 
  35.    --  (Caller identification, loglevel and message). 
  36.  
  37.    function Create 
  38.      (ID      : Task_Id   := Current_Task; 
  39.       Source  : String    := ""; 
  40.       Level   : Log_Level := Debug; 
  41.       Message : String) 
  42.       return Instance; 
  43.    --  Create a log request object from the specified parameters. 
  44.  
  45.    function Get_Caller_ID (Request : Instance) return Task_Id; 
  46.    --  Return the caller ID of the request object. 
  47.  
  48.    function Get_Source (Request : Instance) return String; 
  49.    --  Return the source of the request object. 
  50.  
  51.    function Get_Log_Level (Request : Instance) return Log_Level; 
  52.    --  Return the loglevel of the request object. 
  53.  
  54.    function Get_Message (Request : Instance) return String; 
  55.    --  Return the log message of the request object. 
  56.  
  57. private 
  58.  
  59.    type Instance is tagged record 
  60.       Caller_ID : Task_Id   := Null_Task_Id; 
  61.       Source    : Ada.Strings.Unbounded.Unbounded_String; 
  62.       Level     : Log_Level := Info; 
  63.       Message   : Ada.Strings.Unbounded.Unbounded_String; 
  64.    end record; 
  65.  
  66. end Alog.Log_Request;