source: trunk/design/fastcgi/demo-driver.adb

Last change on this file was 1966, checked in by vadim.godunko, 9 years ago

Add logging to debug problem on Windows.

  • Property svn:keywords set to Author Date Revision
File size: 1.5 KB
Line 
1with Ada.Exceptions;
2with Ada.Streams;
3with Ada.Text_IO;
4
5with League.Application;
6with League.Strings;
7with League.Text_Codecs;
8with FastCGI.Application;
9with Demo.Callbacks;
10
11procedure Demo.Driver is
12 File : Ada.Text_IO.File_Type;
13
14 function To_String (Item : League.Strings.Universal_String) return String is
15 Aux : Ada.Streams.Stream_Element_Array
16 := League.Text_Codecs.Codec_For_Application_Locale.Encode
17 (Item).To_Stream_Element_Array;
18 Result : String (1 .. Aux'Length);
19 Index : Positive := 1;
20
21 begin
22 for J in Aux'Range loop
23 Result (Index) := Character'Val (Aux (J));
24 Index := Index + 1;
25 end loop;
26
27 return Result;
28 end To_String;
29
30begin
31 Ada.Text_IO.Create (File, Ada.Text_IO.Out_File, "/tmp/demo.log");
32-- Ada.Text_IO.Set_Error (File);
33 Ada.Text_IO.Put_Line (File, "Started...");
34
35 Ada.Text_IO.Put_Line
36 (File,
37 To_String (League.Application.Environment.Value
38 (League.Strings.To_Universal_String ("_FCGI_X_PIPE_"))));
39 Ada.Text_IO.Put_Line
40 (File,
41 To_String (League.Application.Environment.Value
42 (League.Strings.To_Universal_String ("_FCGI_SHUTDOWN_EVENT_"))));
43
44 FastCGI.Application.Initialize;
45 FastCGI.Application.Execute (Demo.Callbacks.Handler'Access);
46 FastCGI.Application.Finalize;
47
48 Ada.Text_IO.Close (File);
49
50exception
51 when E : others =>
52 Ada.Text_IO.Put_Line (File, Ada.Exceptions.Exception_Information (E));
53 Ada.Text_IO.Close (File);
54end Demo.Driver;
Note: See TracBrowser for help on using the repository browser.