NAME

Net::Libwebsockets::Logger - Contextual logging

SYNOPSIS

my $logger = Net::Libwebsockets::Logger->new(
    level => Net::Libwebsockets::LLL_ERR | Net::Libwebsockets::LLL_WARN,

    callback => sub ($level, $message) {
        # $level is one of LLL_ERR et al.
    },
);

DESCRIPTION

This class implements a LWS contextual logger, as Net::Libwebsockets’s main documentation describes.

METHODS

$obj = CLASS->new( %OPTS )

Instantiates CLASS. %OPTS are all optional:

  • level - A bitwise-OR of various LLL_* constants from Net::Libwebsockets. Defaults to LWS’s global log level at instantiation time.

  • callback - A coderef that receives 2 arguments: the message’s log level (should match a LLL_* constant), and the message itself. Defaults to LWS’s own default behavior.