[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.
>
> Â
>