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.  
  23. with Ada.Task_Identification; 
  24. with Ada.Strings.Unbounded; 
  25.  
  26. --  Log request type. Log request objects are used for asynchronous logging and 
  27. --  hold all relevant information of a log request. 
  28. package Alog.Log_Request is 
  29.  
  30.    use Ada.Task_Identification; 
  31.  
  32.    type Instance is tagged private; 
  33.    --  A log request contains all related information to log asynchronously 
  34.    --  (Caller identification, loglevel and message). 
  35.  
  36.    function Create 
  37.      (ID      : Task_Id   := Current_Task; 
  38.       Source  : String    := ""; 
  39.       Level   : Log_Level := Debug; 
  40.       Message : String) 
  41.       return Instance; 
  42.    --  Create a log request object from the specified parameters. 
  43.  
  44.    function Get_Caller_ID (Request : Instance) return Task_Id; 
  45.    --  Return the caller ID of the request object. 
  46.  
  47.    function Get_Source (Request : Instance) return String; 
  48.    --  Return the source of the request object. 
  49.  
  50.    function Get_Log_Level (Request : Instance) return Log_Level; 
  51.    --  Return the loglevel of the request object. 
  52.  
  53.    function Get_Message (Request : Instance) return String; 
  54.    --  Return the log message of the request object. 
  55.  
  56. private 
  57.  
  58.    type Instance is tagged record 
  59.       Caller_ID : Task_Id   := Null_Task_Id; 
  60.       Source    : Ada.Strings.Unbounded.Unbounded_String; 
  61.       Level     : Log_Level := Info; 
  62.       Message   : Ada.Strings.Unbounded.Unbounded_String; 
  63.    end record; 
  64.  
  65. end Alog.Log_Request;