- DESCRIPTION
- CONFIGURATION
  - USING LOG::ANY::ADAPTER
  - USING `log_to` AND `trace_to`

# DESCRIPTION

Elasticsearch::Logger::LogAny provides event logging and the tracing of request/response conversations with Elasticsearch nodes via the Log::Any module.

Logging refers to log events, such as node failures, pings, sniffs, etc, and should be enabled for monitoring purposes.

Tracing refers to the actual HTTP requests and responses sent to Elasticsearch nodes. Tracing can be enabled for debugging purposes, or for generating a pretty-printed `curl` script which can be used for reporting problems.

# CONFIGURATION

Logging and tracing can be enabled using Log::Any::Adapter, or by passing options to "new()" in Elasticsearch.

## USING LOG::ANY::ADAPTER

Send all logging and tracing to `STDERR`:

        use Log::Any::Adapter qw(Stderr);
        use Elasticsearch;
        my $e = Elasticsearch->new;

Send logging to a file, and tracing to Stderr:

        use Log::Any::Adapter();
        Log::Any::Adapter->set(
            { category => 'elasticsearch.event' },
            'File',
            '/path/to/file.log'
        );
        Log::Any::Adapter->set(
            { category => 'elasticsearch.trace' },
            'Stderr'
        );

        use Elasticsearch;
        my $e = Elasticsearch->new;

## USING `log_to` AND `trace_to`

Send all logging and tracing to `STDERR`:

        use Elasticsearch;
        my $e = Elasticsearch->new(
            log_to   => 'Stderr',
            trace_to => 'Stderr'
        );

Send logging to a file, and tracing to Stderr:

        use Elasticsearch;
        my $e = Elasticsearch->new(
            log_to   => ['File', '/path/to/file.log'],
            trace_to => 'Stderr'
        );

See Log::Any::Adapter for more.