Search...:Logger(3pm)

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

✨ 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:

  • $code is the HTTP status code
  • $response is the HTTP body
  • $took is 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 πŸ‘‘


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