Logging filter

The logging filter is now part of EWF core (before it was only available in
the filter example) and can therefore be reused by others needing it.
Note that this is a first implementation. It can certainly be improved in
the future to support more fine grained logging.
This commit is contained in:
Olivier Ligot
2012-12-03 16:29:12 +01:00
committed by Jocelyn Fiat
parent 156406f9ac
commit 075ac1d628
2 changed files with 15 additions and 8 deletions

View File

@@ -1,40 +0,0 @@
note
description: "Logging filter."
author: "Olivier Ligot"
date: "$Date$"
revision: "$Revision$"
class
LOGGING_FILTER
inherit
WSF_FILTER
feature -- Basic operations
execute (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Execute the filter
local
l_user_agent: STRING
l_date: DATE_TIME
do
if attached req.http_user_agent as ua then
l_user_agent := ua.as_string_8
else
l_user_agent := "-"
end
create l_date.make_now
io.put_string ("[" + l_date.formatted_out (Date_time_format) + "] %"" + req.request_method + " " + req.request_uri
+ " " + {HTTP_CONSTANTS}.http_version_1_1 + "%" " + res.status_code.out + " " + l_user_agent)
io.put_new_line
execute_next (req, res)
end
feature -- Constants
Date_time_format: STRING = "yyyy/[0]mm/[0]dd [0]hh:[0]mi:[0]ss.ff3"
note
copyright: "2011-2012, Olivier Ligot, Jocelyn Fiat and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
end

View File

@@ -53,7 +53,7 @@ feature {NONE} -- Initialization
setup_filter
-- Setup `filter'
local
l_logging_filter: LOGGING_FILTER
l_logging_filter: WSF_LOGGING_FILTER
do
create l_logging_filter
filter.set_next (l_logging_filter)