Rombobjörn

summaryrefslogtreecommitdiff
path: root/system_log.ads
diff options
context:
space:
mode:
Diffstat (limited to 'system_log.ads')
-rw-r--r--system_log.ads89
1 files changed, 89 insertions, 0 deletions
diff --git a/system_log.ads b/system_log.ads
new file mode 100644
index 0000000..002218d
--- /dev/null
+++ b/system_log.ads
@@ -0,0 +1,89 @@
+-- System_Log, a binding to the Unix syslog functions
+-- Copyright 2009 B. Persson, Bjorn@Rombobeorn.se
+--
+-- This library is free software: you can redistribute it and/or modify it
+-- under the terms of the GNU General Public License version 3, as published
+-- by the Free Software Foundation.
+
+
+package System_Log is
+
+ -- System_Log is a binding to the Unix syslog functions. The logging
+ -- functionality is common to all tasks. This binding is tasking-safe if the
+ -- underlying C library is, except as noted below for Open_Log and Close_Log.
+
+ type Log_Facility is
+ (Kernel, -- kernel messages
+ User, -- random user-level messages
+ Mail, -- mail system
+ Daemon, -- system daemons
+ Syslog, -- messages generated internally by syslogd
+ LPR, -- line printer subsystem
+ News, -- network news subsystem
+ UUCP, -- UUCP subsystem
+ Cron, -- clock daemon
+ Authpriv, -- security/authorization messages (private)
+ FTP, -- ftp daemon
+ 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
+
+ type Log_Level 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
+
+ type Log_Levels is array(Log_Level) of Boolean;
+ for Log_Levels'Size use 8;
+ pragma Pack(Log_Levels);
+
+ procedure Open_Log(Source_Name : in String;
+ Facility : in Log_Facility;
+ Console_On_Error : in Boolean := False;
+ Delay_Open : in Boolean := True;
+ Standard_Error_Too : in Boolean := False;
+ Include_PID : in Boolean := False);
+ -- Open_Log is used to specify how logging shall be done. It will connect to
+ -- the system logger if Delay_Open is false. Calling Open_Log is optional.
+ -- The connection to the system logger will be opened if necessary when Log
+ -- is called.
+ -- Open_Log will normally only be called once. If it must be called again,
+ -- Close_Log should be called in between to avoid leaking memory.
+
+ procedure Set_Log_Levels(New_Levels : in Log_Levels);
+ procedure Set_Log_Levels(New_Levels : in Log_Levels;
+ Old_Levels : out Log_Levels);
+ -- Set_Log_Levels activates those log levels that are true in New_Levels and
+ -- deactivates those that are false. The second form reports in Old_Levels
+ -- which log levels were active before the call.
+
+ procedure Set_Log_Threshold(Threshold : in Log_Level);
+ -- Set_Log_Threshold activates the log levels from Emergency to Threshold,
+ -- inclusive, and deactivates the rest.
+
+ procedure Log(Level : in Log_Level; Message : in String);
+ -- Sends the message Message to the system logger if the log level Level is
+ -- active, using the facility that was passed to Open_Log.
+
+ procedure Log(Facility : in Log_Facility;
+ Level : in Log_Level;
+ Message : in String);
+ -- Sends the message Message to the system logger if the log level Level is
+ -- active, using the facility Facility.
+
+ procedure Close_Log;
+ -- Close_Log closes the connection to the system logger. Calling Close_Log
+ -- before terminating is optional. In a multitasked program, Close_Log should
+ -- not be called from multiple tasks simultaneously.
+
+end System_Log;