libmicrohttpd
[Top][All Lists]
Advanced

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

Re: [libmicrohttpd] External logging


From: Sreejith.D
Subject: Re: [libmicrohttpd] External logging
Date: Thu, 29 Nov 2018 10:53:13 +0000

Oops 😊 Thank you for the prompt reply to a naïve bug.

But good to know that the logging would work.

-Sreejith.

-----Original Message-----
From: Christian Grothoff <address@hidden> 
Sent: Thursday, November 29, 2018 3:56 PM
To: D, Sreejith; address@hidden
Cc: address@hidden
Subject: Re: External logging

There is one tiny bug. You are dereferencing 'arg', but never passed its 
address. So use:

  MHD_OPTION_EXTERNAL_LOGGER,
  MHD_external_logger, (void*) &MHD_logger,

and it should work.

On 11/29/18 9:25 AM, address@hidden wrote:
> 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
> 
>  
> 
> voidMHD_external_logger(void* arg, constchar* fmt, va_listap)
> 
> {
> 
>       
> 
>        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, 
> (unsignedint)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]