/usr/share/ada/adainclude/gnatcoll/gnatcoll-traces-syslog.ads is in libgnatcoll1.6-dev 1.6gpl2014-6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 | ------------------------------------------------------------------------------
-- G N A T C O L L --
-- --
-- Copyright (C) 2001-2014, AdaCore --
-- --
-- This library is free software; you can redistribute it and/or modify it --
-- under terms of the GNU General Public License as published by the Free --
-- Software Foundation; either version 3, or (at your option) any later --
-- version. This library is distributed in the hope that it will be useful, --
-- but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- --
-- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. --
-- --
-- --
-- --
-- --
-- --
-- You should have received a copy of the GNU General Public License and --
-- a copy of the GCC Runtime Library Exception along with this program; --
-- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
-- <http://www.gnu.org/licenses/>. --
-- --
------------------------------------------------------------------------------
-- Interface to syslog.
-- This package provides two levels of interfaces:
-- - a low level interface to syslog (on Unix systems)
-- - a higher level interface that can be used through GNAT.Traces.
-- syslog is the system logger on Unix systems.
package GNATCOLL.Traces.Syslog is
Stream_Syslog : constant String := "syslog";
-- Name of the stream that can be used in GNAT.Traces configuratino files
-- or calls to Create to send a stream to syslog.
-- You must have called Register_Syslog_Stream (see below) first.
procedure Register_Syslog_Stream;
-- Register a GNAT.Traces stream that can send its output to the system
-- logger syslog. This stream takes two optional arguments which are the
-- facility and the level to pass to calls to Syslog (see below).
-- For instance, your configuration file for GNAT.Traces could contains
-- SYSLOG_ERROR=yes >&syslog:local0:error
-- SYSLOG_INFO=yes >&syslog:local0:info
-- and then your Ada code can use:
-- Errors : Trace_Handle := Create ("SYSLOG_ERROR");
-- Info : Trace_Handle := Create ("SYSLOG_INFO");
-- Trace (Errors, "An error");
-- to send messages to syslog. Since GNAT.Traces can be configured
-- dynamically, this means that the Errors stream defined above could be
-- redirected for instance to stdout instead on systems where syslog is not
-- supported.
-----------------------------------
-- Low-level interface to syslog --
-----------------------------------
-- The following types and subprograms can be used if you need to interface
-- directly to syslog. One drawback is that these are not usable (will not
-- even exist) on systems that do not have syslog.
--
-- A message sent to syslog has two attributes: its facility, and its
-- level. The facility indicates what type of program is logging the
-- message. This lets the syslog configuration file (system-wide) specify
-- that messages from different facilities will be handled differently.
-- The level determines the importance of the message.
type Levels is
(Emergency, -- system is unusable
Alert, -- action must be taken immediately
Critical, -- critical conditions
Error, -- error conditions
Warning, -- warning conditions
Notice, -- normal but significant condition
Info, -- informational
Debug); -- debug-level messages
-- Importance of the messages, in order of decreasing importance
type Facilities is
(Kernel, -- kernel messages
User, -- random user-level messages
Mail, -- mail system
Daemon, -- system daemons
Auth, -- security/authorization messages
Sys_Log, -- messages generated internally
Printer, -- line printer subsystem
News, -- network news subsystem
UUCP, -- UUCP subsystem
Cron, -- clock daemon
Auth_Priv, -- security/authorization messages
FTP, -- ftp daemon
NTP, -- ntp daemon
Security, -- security subsystems
Console, -- /dev/console output
Local0, -- reserved for local use
Local1, -- reserved for local use
Local2, -- reserved for local use
Local3, -- reserved for local use
Local4, -- reserved for local use
Local5, -- reserved for local use
Local6, -- reserved for local use
Local7); -- reserved for local use
-- What type of program is logging the message
type Options is mod Integer'Last;
-- Options when opening the connection to syslog
None : constant Options; -- no options at all
PID : constant Options; -- log the pid with each message
Cons : constant Options; -- log on the console if errors
Open_Delay : constant Options; -- delay open() until first call to syslog()
No_Delay : constant Options; -- don't delay open()
No_Wait : constant Options; -- don't wait for console forks
Std_Error : constant Options; -- log to stderr as well
procedure Openlog
(Prefix : String;
Customization : Options;
Default_Facility : Facilities);
-- The (optional) call to this subprogram specifies the attributes of the
-- connection to syslog. In particular, Prefix will be prepended to every
-- message, and is in general used to specify the name of the program.
-- Customization specifies flags to control the connection (in particular
-- whether the PID of the process should be logged).
-- Finally, Default_Facility will be used when the call to Syslog (see
-- below) does not specify the facility.
procedure Syslog
(Facility : Facilities := Kernel;
Level : Levels := Emergency;
Message : String);
-- Writes Message to the system logger. If Facility is left to its default
-- value, the priority specified in the call to Openlog will be used
-- instead.
procedure Closelog;
-- The (optional) call to this subprogram closes the connection with syslog
private
None : constant Options := 16#00#;
PID : constant Options := 16#01#;
Cons : constant Options := 16#02#;
Open_Delay : constant Options := 16#04#;
No_Delay : constant Options := 16#08#;
No_Wait : constant Options := 16#10#;
Std_Error : constant Options := 16#20#;
end GNATCOLL.Traces.Syslog;
|