libmicrohttpd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libmicrohttpd] External logging


From: Sreejith.D
Subject: [libmicrohttpd] External logging
Date: Thu, 29 Nov 2018 08:25:19 +0000

Hi MHD team/Christian,

 

I implemented MHD in a windows application via MSYS. To detect some intermittent connection-break issues, I implemented external logging. It looks straightforward and that is why I doubt if it is the right way to do, too… messages are enabled (not compiled with –disable-messages) and I also use MHD_USE_DEBUG.

 

FILE* MHD_logger = NULL; //somewhere in the code

 

void MHD_external_logger(void * arg, const char * fmt, va_list ap)

{

      

       if (arg != NULL)

       {

              FILE* _fptr = *((FILE**)(arg));

              vfprintf_s(_fptr, fmt, ap);

       }

}

 

//…

//

m_pMhd = MHD_start_daemon(flags | MHD_USE_DEBUG, gblusport,

                             //NULL,NULL,

                             AcceptPolicyCallback, this,

                             AccessHandlerCallback, this,

                             MHD_OPTION_CONNECTION_TIMEOUT, (unsigned int)120,

                             MHD_OPTION_SOCK_ADDR, &addr,

                             MHD_OPTION_HTTPS_MEM_KEY, key_file_pem.c_str(),

                             MHD_OPTION_HTTPS_MEM_CERT, cert_file_pem.c_str(),

                             MHD_OPTION_EXTERNAL_LOGGER, MHD_external_logger, (void*)MHD_logger,

                             MHD_OPTION_ARRAY, &ops[0],

                             MHD_OPTION_END);

 

 

-Sreejith.

 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]