[Libwebsockets] Porting libwebsockets_set_log_callback to canonical libwebsockets

Andy Green andy at warmcat.com
Mon Oct 6 00:50:32 CEST 2014



On 6 October 2014 01:29:03 GMT+08:00, "Bartosz Gołaszewski" <bartekgola at gmail.com> wrote:
>Hi,
>
>there is a fork of libwebsockets at
>https://github.com/davidgaleano/libwebsockets.

I worked with David to empty everything useful from that back into canonical lws a year or so ago.  I think you find that fork is no longer maintained.

>It has a function - libwebsockets_set_log_callback - which allows user
>programs to intercept library log messages which is a very handy
>feature. Will a patch porting this function to upstream libwebsockets
>be accepted?

I already built in nice and flexible logging, you can set a function pointer using an api who is responsible to emit the logs.  For example, this is a built-in emit function that is exported to hook the logs to syslog

http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/tree/lib/lws-plat-unix.c#n73

If you look in the test server, you can see the api used to set the emit function for logging

http://git.libwebsockets.org/cgi-bin/cgit/libwebsockets/tree/test-server/test-server.c#n856

and the debug versosity level to emit at the same time.  This is enough to do anything you want with the logging including use it in your user code, add timestamps etc.

-Andy

>Best regards,
>Bartosz Golaszewski
>_______________________________________________
>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org
>http://ml.libwebsockets.org/mailman/listinfo/libwebsockets




More information about the Libwebsockets mailing list