[web-devel] A logging system as a WAI middleware

Kazu Yamamoto ( 山本和彦 ) kazu at iij.ad.jp
Wed Aug 10 09:48:44 CEST 2011


OK.

I think we should take the following steps:

1) Implement a logging system as library first
2) WAI guys use it and share experience
3) Consider whether or not we can make it as a WAI middleware

P.S.

You can record both normal log messages and error messages if you use
my log system twice. You can chose file or stdout. (If people think
stderr is appropriate, I will change.)

--Kazu

> Well, (1) isn't really an option: there are very specific reasons why
> the code is structured that way. That said, I think it could
> theoretically be possible to build a middleware like that anyway.
> Also, it might be acceptable to simply output a more generic log
> message on ResponseEnumerator, as it shouldn't be very common.
> 
> If you want, I can take a crack at implementing the code for
> ResponseEnumerator, just tell me where you have your current code.
> 
> And for (2): I think it would be useful no matter what to have a
> library function for debug messages.
> 
> Michael
> 
> On Wed, Aug 10, 2011 at 9:17 AM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
>> Hello,
>>
>> Greg Weber asked me to implement a logging system as a WAI middleware.
>> So, I considered it.
>>
>> The typical Apache log format is as follows:
>>
>>        127.0.0.1 - - [10/Aug/2011:11:27:34 +0900] "GET / HTTP/1.1" 200 512 "referer" "agent"
>>
>>        where 200 is status and 512 is a response size
>>
>> Response is defined as follows:
>>
>>         ResponseFile Status ResponseHeaders FilePath (Maybe FilePart)
>>         ResponseBuilder Status ResponseHeaders Builder
>>         ResponseEnumerator (forall a. ResponseEnumerator a)
>>
>> We cannot know status from ResponseEnumerator. Also, we cannot
>> directly know size from the all three.
>>
>> Design choices are as follows:
>>
>> 1) Modified the Response type and implement a logging system as a
>>   WAI middleware.
>> 2) Giving up implementing a logging system as a WAI middleware
>>   and implement a logging system as just a library.
>>
>> Which one is better?
>>
>> --Kazu
>>
>> _______________________________________________
>> web-devel mailing list
>> web-devel at haskell.org
>> http://www.haskell.org/mailman/listinfo/web-devel
>>
> 



More information about the web-devel mailing list