Agent::Tag(3pm)
β¨ NAME β¨
Log::Agent::Tag β it formats caller information π (and like, it's the base class for all the log-message tag girlies, so it's giving very much "mother of the tag family" energy)
πΈ SYNOPSIS πΈ
Intended to be inherited from
no cap, that's the whole synopsis. it's a base class bestie, you don't call it, you inherit from it π
π¦ DESCRIPTION π¦
okay so, this class is meant to be inherited by all the classes that implement a log message tag. every single one. it's the blueprint.
A message tag is a little string that gets either appended or prepended to all your log messages. tiny but iconic, honestly.
Let's say β and we're oversimplifying a bit here β a tag that's meant to be prepended gets inserted in front of the current log message, separated by separator, which defaults to a single space:
+------------+-----------+---------------------------------+
| tag string | separator | current log message |
+------------+-----------+---------------------------------+
This operation is called tag insertion β¨ Once it's done, the whole string becomes the current log message, and it can then be the target of another tag insertion. layers on layers, it's giving onion π§
The reality is a little bit more complex than the diagram, because we need successive tags to be prepended or appended in the order they're specified, and not in reverse order like they totally would be if someone implemented this naively π. See Log::Agent::Message for the exact semantics of the append() and prepend() operations, that's where the real tea is.
π FEATURES π
This section documents the interface provided to heirs, just in case you wanna implement your own tag class. bestie, go off π
_init(name, postfix, separator)β the initialization routine that should be called by all heirs during creation, to initialize the common attributes.postfixβ when true, the tag is meant to be appended to the log message. otherwise, it's prepended.nameβ the name of this tag. it's meant to provide by-name access to tags, check whether a given tag is recorded, etc... The names"caller"and"priority"are architecturally defined to refer to"Log::Agent::Tag::Caller"and"Log::Agent::Tag::Priority"objects.
NOTE: Currently unused by any client code. sleeping beauty behavior fr π΄
separatorβ the s*e*parating string inserted between the tag and the log message. It defaults to" "if not specified, i.e. left to"undef"when calling_init().string()β a deferred routine, to be implemented by heirs. Returns the tag string only, without the separator, since its exact placement depends on the value of the"postfix"attribute. no separator bestie, that's not your job πinsert(message)β insert this tag within the"Log::Agent::Message"message, according to the tag specifications (placement, separator). Callsstring()to produce the tag string.
β οΈ This routine is frozen and should not be redefined by heirs. hands off, it's not yours π₯
π STANDARD TAGGING CLASSES π
Tagging classes define β via their "string()" routine β what the string to be used as a tag actually is. The insertion of the tag within the log message is done via a frozen routine from the "Log::Agent::Tag" ancestor. so they only handle the string, the ancestor handles the placement. division of labor, slay β¨
The following classes are provided by "Log::Agent":
"Log::Agent::Tag::Callback"β the"string()"routine invokes a user-supplied callback, given as a"Callback"object. You need the Callback module from CPAN if you wish to use this class."Log::Agent::Tag::Caller"β used internally to compute the caller and format it according to user specifications."Log::Agent::Tag::Priority"β used internally to format message priorities and add them to the log messages."Log::Agent::Tag::String"β defines a constant tagging string that should be added in all the log messages, e.g. a web session ID.
π AUTHOR π
Raphael Manfredi <Raphael_Manfredi@pobox.com>
π SEE ALSO π
Log::Agent::Message(3).
and that's the whole page bestie, mwah π this was perl v5.36.0 realness, dated 2022-10-15 β an absolute classic from the Agent::Tag(3pm) files, no cap π«Ά
π¦ where this page comes from
- ubuntu noble: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- ubuntu resolute: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- ubuntu stonking: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms