Vibe.D - log requests and responses
    Jacob Carlborg via Digitalmars-d-learn 
    digitalmars-d-learn at puremagic.com
       
    Wed Nov 23 23:57:47 PST 2016
    
    
  
On 2016-11-24 07:29, Saurabh Das wrote:
> Hi,
>
> Is there an easy way to log all incoming requests and outgoing responses
> (and perhaps processing time, wait time, etc) in Vibe.D?
Yes. You can configure the logging on the HTTPServerSettings [1] 
instance. If you look at the documentation, the first four fields are 
related to logging. Use "accessLogFile" to set the filename of the log 
file. Use "accessLogFormat" to configure the log format. It uses the 
same syntax as Apache. Unfortunately the syntax is not documented in 
vibe.d and it doesn't implement all of the features that Apache has. I 
looked at the source code to figure out the format [2]. %D will give you 
the time taken to serve the request in milliseconds and %T in seconds. 
%t will give you the time stamp the request was received. I don't see 
anything related to waiting time.
With the "accessLogger" field you can specify a custom logger.
[1] http://vibed.org/api/vibe.http.server/HTTPServerSettings
[2] 
https://github.com/rejectedsoftware/vibe.d/blob/master/http/vibe/http/log.d#L92
-- 
/Jacob Carlborg
    
    
More information about the Digitalmars-d-learn
mailing list