/* libzzinet
 *
 * This program is distributed under the GNU General Public License, version 2.
 * A copy of this license is included with this source.
 *
 * Copyright 2000-2006, Toni Thomsson <toni@tonjac.org> 
*/

/**
    Webserver access log

    @author Toni Thomsson, toni@tonjac.org
*/

#ifndef zz_access_log_h
#define zz_access_log_h

#include <zz_http_request.h>
#include <zz_file.h>
#include <zz_win_threadmutex.h>

class ZZ_API CzzAccessLog
{
public:

    /**
        Construction

        @param file Full path to webserver access log
    */
    CzzAccessLog( const char* file );
    virtual ~CzzAccessLog();

    /**
        Writes a entry in the access log

        @param req Request
        @param responce_code HTTP response code 100-500
        @param size Size of reply in bytes
    */
    virtual void write( CzzHTTPRequest* req, int responce_code, int size );

protected:
private:

    unsigned __int64  getTime( void );
    int CzzAccessLog::getClfTime( char *buffer, unsigned len, struct tm *t );

    CzzFile m_File;
    static CzzWinThreadMutex m_Mutex;
};

#endif // zz_access_log_h