Search...:Logger(3pm)
β¨ NAME β¨
okay bestie, so this is Search::Elasticsearch::Role::Logger π β it's a Perl role (from the Search...:Logger manual page, part of the Perl docs) that hands out all the common functionality to Logger implementations, so everyone can log events and trace request-response convos with Elasticsearch nodes together. iykyk πΈ
π VERSION π
version 8.12 β yes, that's the one, no cap π
π DESCRIPTION π
so basically, this role is the shared glue that every Logger implementation gets to inherit. it provides common functionality to Logger implementations, which is what enables:
- the logging of events π
- the tracing of request-response conversations with Elasticsearch nodes π
and if you're wondering what the default implementation looks like, go peek at Search::Elasticsearch::Logger::LogAny β that's the one you get out of the box π«Ά
π CONFIGURATION π
πΈ "log_to"
whatever parameters you pass into "log_to" get used by Search::Elasticsearch::Role::Logger implementations to set up the "log_handle()". it's giving setup energy β¨. see Search::Elasticsearch::Logger::LogAny for the deets.
π¦ "log_as"
by default, events emitted by "debug()", "info()", "warning()", "error()" and "critical()" get logged to the "log_handle()" under the category "elasticsearch.event". but wait β you can change that category with "log_as" π
β "trace_to"
parameters passed to "trace_to" are used by Search::Elasticsearch::Role::Logger implementations to set up the "trace_handle()". see Search::Elasticsearch::Logger::LogAny for details π
π§ "trace_as"
by default, trace output emitted by "trace_request()", "trace_response()", "trace_error()" and "trace_comment()" is logged under the category "elasticsearch.trace" β and yeah, "trace_as" is the vibe check that lets you configure it π
π "deprecate_to"
parameters passed to "deprecate_to" are used by Search::Elasticsearch::Role::Logger implementations to set up the "deprecate_handle()". see Search::Elasticsearch::Logger::LogAny for details π
π "deprecate_as"
by default, events emitted by "deprecation()" are logged to the "deprecate_handle()" under the category "elasticsearch.deprecation", which you can configure with "deprecate_as" π
π₯ METHODS π₯
π log_handle()
returns an object which can handle the methods: debug(), debugf(), is_debug(), info(), infof(), is_info(), warning(), warningf(), is_warning(), error(), errorf(), is_error(), critical(), criticalf() and is_critical(). literally the whole squad π
π trace_handle()
returns an object which can handle the methods: trace(), tracef() and is_trace(). small but mighty β¨
π«Ά deprecate_handle()
returns an object which can handle the warnf() method. just the one bestie, and she's important π
π trace_request()
$logger->trace_request($cxn,\%request);
accepts a Cxn object and request parameters, and logs them if tracing is enabled. no tracing enabled? then nothing happens, periodt.
πΈ trace_response()
$logger->trace_response($cxn,$code,$response,$took);
logs a successful HTTP response, where:
$codeis the HTTP status code$responseis the HTTP body$tookis the time the request took in seconds β±οΈ
π trace_error()
$logger->trace_error($cxn,$error);
logs a failed HTTP response, where $error is an Search::Elasticsearch::Error object π (yes, we log the L too, that's the job)
π¦ trace_comment()
$logger->trace_comment($comment);
used to insert debugging comments into trace output. it's giving main character commentary π
β deprecation()
$logger->deprecation($warning,$request)
issues a deprecation warning to the deprecation logger. consider yourself warned, bestie π
β¨ AUTHOR β¨
Enrico Zimuel <enrico.zimuel@elastic.co> β iconic behavior honestly π
π COPYRIGHT AND LICENSE π
This software is Copyright (c) 2024 by Elasticsearch BV.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
and that's the whole page, bestie π this was Search...:Logger(3pm) from the User Contributed Perl Documentation, running under perl v5.38.2, dated 2024-02-04 β slay, go log something iconic πβ¨
π¦ where this page comes from
- debian trixie: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu noble: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu resolute: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- ubuntu stonking: libsearch-elasticsearch-perl 8.12-1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms