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
|
with Alog.Logger;
with Alog.Facilities.File_Descriptor;
use Alog;
-- Alog logger example.
procedure Logger_Example1 is
-- Initialize logger instance with default file descriptor facility
-- (logs to stdout).
Log : Logger.Instance (Init => True);
begin
-- Write a message with loglevel 'Info' to stdout.
Log.Log_Message
(Level => Info,
Msg => "This is a testmessage from Alog logger");
Attach_FD_Facility :
declare
FD : constant Facilities.File_Descriptor.Handle :=
new Facilities.File_Descriptor.Instance;
begin
FD.Set_Logfile (Path => "/tmp/alog.log");
Log.Attach_Facility (Facility => Facilities.Handle (FD));
-- Log a message to file and stdout.
Log.Log_Message (Source => "Example",
Level => Warning,
Msg => "Another testmessage");
end Attach_FD_Facility;
end Logger_Example1;
|