procedure Log_View

with Ada.IO_Exceptions;
with Ada.Streams.Stream_IO; 
with Ada.Text_IO;
with Ada.Tags;
use  Ada;

with Ada_Store.Log;
with Ada_Store.PoST.Application;
with Ada_Store.User;
use  Ada_Store;

procedure Log_View is

   Log_File_Name : constant String := "Ada_Store.log";
   As_File	 : Streams.Stream_IO.File_Type;
   As_Stream	 : Streams.Stream_IO.Stream_Access;
begin
   Streams.Stream_IO.Open(File => As_File,
			  Mode => Streams.Stream_IO.In_File,
			  Name => Log_File_Name);
   As_Stream := Streams.Stream_IO.Stream(As_File);
   Text_IO.Put_Line("Log View v.1.0 Started");
   loop
      declare
	 An_Element : Log.Element'Class := Log.Element'Class'Input(As_Stream);
      begin
	 Text_IO.Put_Line(Tags.Expanded_Name(An_Element'Tag) &
			  " read");
	 Text_IO.Put_Line(Log.To_String(An_Element));
      end;
   end loop;
   Text_IO.Put_Line("Log View Completed");
   Streams.Stream_IO.Close(As_File);
exception
   when IO_Exceptions.Name_Error =>
      Text_IO.Put_Line("Could not open log file");
   when IO_Exceptions.Data_Error =>
      Text_IO.Put_Line("Error reading log file");
end Log_View;

Contents Page

Copyright © 1996 Simon Johnston &
Addison Wesley Longman