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