1. ----------------------------------------------------------------------- 
  2. --               GtkAda - Ada95 binding for Gtk+/Gnome               -- 
  3. --                                                                   -- 
  4. --                   Copyright (C) 2003 ACT-Europe                   -- 
  5. --                                                                   -- 
  6. -- This library is free software; you can redistribute it and/or     -- 
  7. -- modify it under the terms of the GNU General Public               -- 
  8. -- License as published by the Free Software Foundation; either      -- 
  9. -- version 2 of the License, or (at your option) any later version.  -- 
  10. --                                                                   -- 
  11. -- This library is distributed in the hope that it will be useful,   -- 
  12. -- but WITHOUT ANY WARRANTY; without even the implied warranty of    -- 
  13. -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU -- 
  14. -- General Public License for more details.                          -- 
  15. --                                                                   -- 
  16. -- You should have received a copy of the GNU General Public         -- 
  17. -- License along with this library; if not, write to the             -- 
  18. -- Free Software Foundation, Inc., 59 Temple Place - Suite 330,      -- 
  19. -- Boston, MA 02111-1307, USA.                                       -- 
  20. --                                                                   -- 
  21. -- As a special exception, if other files instantiate generics from  -- 
  22. -- this unit, or you link this unit with other files to produce an   -- 
  23. -- executable, this  unit  does not  by itself cause  the resulting  -- 
  24. -- executable to be covered by the GNU General Public License. This  -- 
  25. -- exception does not however invalidate any other reasons why the   -- 
  26. -- executable file  might be covered by the  GNU Public License.     -- 
  27. ----------------------------------------------------------------------- 
  28.  
  29. --  <description> 
  30. --  This package provides low level routines for enabling, disabling 
  31. --  and modifying the way log messages are handled in glib/gdk/gtk. 
  32. --  </description> 
  33. --  <group>Glib, the general-purpose library</group> 
  34.  
  35. package Glib.Messages is 
  36.    pragma Preelaborate; 
  37.  
  38.    type Log_Level_Flags is mod 2 ** 32; 
  39.    --  log levels and flags. 
  40.  
  41.    --------------- 
  42.    -- log flags -- 
  43.    --------------- 
  44.  
  45.    Log_Flag_Recursion : constant Log_Level_Flags := 2 ** 0; 
  46.    Log_Flag_Fatal     : constant Log_Level_Flags := 2 ** 1; 
  47.  
  48.    ---------------- 
  49.    -- log levels -- 
  50.    ---------------- 
  51.  
  52.    Log_Level_Error    : constant Log_Level_Flags := 2 ** 2; 
  53.    --  always fatal 
  54.  
  55.    Log_Level_Critical : constant Log_Level_Flags := 2 ** 3; 
  56.    Log_Level_Warning  : constant Log_Level_Flags := 2 ** 4; 
  57.    Log_Level_Message  : constant Log_Level_Flags := 2 ** 5; 
  58.    Log_Level_Info     : constant Log_Level_Flags := 2 ** 6; 
  59.    Log_Level_Debug    : constant Log_Level_Flags := 2 ** 7; 
  60.  
  61.    Log_Level_Mask     : constant Log_Level_Flags := 
  62.      not (Log_Flag_Recursion or Log_Flag_Fatal); 
  63.  
  64.    Log_Fatal_Mask     : constant Log_Level_Flags := 
  65.      Log_Flag_Recursion or Log_Level_Error; 
  66.    --  log levels that are considered fatal by default 
  67.  
  68.    type Log_Function is access procedure 
  69.      (Log_Domain : String; 
  70.       Log_Level  : Log_Level_Flags; 
  71.       Message    : UTF8_String); 
  72.  
  73.    type Log_Handler_Id is new Guint; 
  74.  
  75.    --  Logging mechanism 
  76.  
  77.    function Log_Set_Handler 
  78.      (Log_Domain : String; 
  79.       Log_Levels : Log_Level_Flags; 
  80.       Log_Func   : Log_Function) return Log_Handler_Id; 
  81.    --  Set a log function for the given log levels, and return its id. 
  82.  
  83.    procedure Log_Remove_Handler 
  84.      (Log_Domain : String; 
  85.       Handler_Id : Log_Handler_Id); 
  86.    --  Unset a given handler. 
  87.  
  88.    procedure Log_Default_Handler 
  89.      (Log_Domain : String; 
  90.       Log_Levels : Log_Level_Flags; 
  91.       Message    : UTF8_String); 
  92.    --  The default log handler. 
  93.    --  Can be called e.g. within a user defined log handler. 
  94.  
  95.    procedure Log 
  96.      (Log_Domain : String; 
  97.       Log_Levels : Log_Level_Flags; 
  98.       Message    : UTF8_String); 
  99.    --  Log a message through the glib logging facility. 
  100.  
  101.    function Log_Set_Fatal_Mask 
  102.      (Log_Domain : String; 
  103.       Fatal_Mask : Log_Level_Flags) return Log_Level_Flags; 
  104.    --  Set the level at which messages are considered fatal for a given domain. 
  105.  
  106.    function Log_Set_Always_Fatal 
  107.      (Fatal_Mask : Log_Level_Flags) return Log_Level_Flags; 
  108.    --  Set the level at which messages are considered fatal for any domain. 
  109.  
  110. private 
  111.  
  112.    pragma Import (C, Log_Set_Always_Fatal, "g_log_set_always_fatal"); 
  113.  
  114. end Glib.Messages;