[Libwebsockets] libwebsockets's log

Andy Green andy at warmcat.com
Sat Aug 23 11:56:31 CEST 2014

On 23 August 2014 17:00:00 GMT+08:00, Priyaranjan Nayak <priyaranjan4169 at gmail.com> wrote:
>Hi Andy,
>Cloud you please tell me ,how can I redirect all the logs to a file in

1) by default lws emits logs to stderr.  So one way is redirect stderr

Yourapp 2>lws.log

Or so.

2) When you call lws_set_log_level(), one of the arguments is a pointer to the function responsible to 'emit' the log.

If you give NULL, it's left as it was.  You can provide your own emit function that does what you want.

3) There's a canned emit function also in lws when running on *nix type platform for convenience, lwsl_emit_syslog, you can use as an emit function.

This maps the various log types to syslog levels and emits to syslog.

If you're on *nix, probably that one is your best bet, he will come in journalctl etc.


>Libwebsockets mailing list
>Libwebsockets at ml.libwebsockets.org

More information about the Libwebsockets mailing list