Search...:LogAny(3pm)

πŸ“¦
version 8.12 Β· 5 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Search...:LogAny(3pm) β€” the manual, but make it make sense πŸ’–

okay bestie, gather round, because this one is literally a whole vibe. it's Search::Elasticsearch::Logger::LogAny from the User Contributed Perl Documentation corner of the internet, and it's about to be your new fave. no cap.


✨ NAME ✨

Search::Elasticsearch::Logger::LogAny β€” a Log::Any-based Logger implementation. that's it, that's the name, she's serving exactly what it says on the tin πŸŽ€


🌸 VERSION 🌸

version 8.12 β€” she's grown, she's evolved, she's iconic πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

Search::Elasticsearch::Logger::LogAny provides event logging and the tracing of request/response conversations with Elasticsearch nodes via the Log::Any module. so like, it's the girl in the group chat who writes down everything that happens. receipts, always. πŸ’œ

Let's break down the three moods she has, because they are NOT the same thing:

  • Logging β€” this is log events, like node failures, pings, sniffs, etc. and honestly? you should enable it for monitoring purposes. it's giving "safety first, bestie". 🫢
  • Tracing β€” this is the actual HTTP requests and responses sent to Elasticsearch nodes. turn it on for debugging purposes, OR for generating a pretty-printed curl script that you can use for reporting problems. yes, she'll literally write your bug report for you. main character behaviour fr fr. ✨
  • Deprecations β€” these are deprecation warnings returned by Elasticsearch 5.x and above. Deprecations are logged to STDERR by default. listen, when Elasticsearch says "this is going away", she says it back to you. out loud. on STDERR. 😭

🌈 CONFIGURATION 🌈

Logging and tracing can be enabled using Log::Any::Adapter, or by passing options to "new()" in Search::Elasticsearch. two paths, one destination, choose your fighter πŸ’–

πŸŽ€ USING LOG::ANY::ADAPTER

Want everything β€” logging and tracing β€” going straight to STDERR? say less:

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

but what if you want to be fancy and split it up? Send logging and deprecations to a file, and tracing to Stderr. now that's organisation, that's a girl who has her life together:

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

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

look at those category keys β€” elasticsearch.event, elasticsearch.trace, elasticsearch.deprecation β€” separated, labelled, thriving. πŸ’…

🧚 USING "log_to", "trace_to" AND "deprecate_to"

not a Log::Any::Adapter girl? that's fine, we don't gatekeep. Send all logging and tracing to STDERR the direct way:

use Search::Elasticsearch;
my $e = Search::Elasticsearch->new(
    log_to   => 'Stderr',
    trace_to => 'Stderr',
    deprecate_to => 'Stderr'  # default
);

and the split version β€” Send logging and deprecations to a file, and tracing to Stderr:

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

See Log::Any::Adapter for more. she has lore, go read it. πŸ“š


πŸ‘‘ AUTHOR πŸ‘‘

Enrico Zimuel <enrico.zimuel@elastic.co> β€” thank you for your service, king πŸ«‘πŸ’–


This software is Copyright (c) 2024 by Elasticsearch BV.

This is free software, licensed under:

The Apache License, Version 2.0, January 2004

free software, Apache 2.0, January 2004 β€” legal girlies ate and left no crumbs. πŸ“œβœ¨


and that's the whole page, bestie. go forth, log your events, trace your requests, and let Elasticsearch whisper its deprecations to STDERR while you sip your iced coffee. 🌸

this was perl v5.38.2, dated 2024-02-04, and the manual was Search...:LogAny(3pm) β€” mwah, bye, slay, periodt πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from