1Log::Any::Proxy::WithStUascekrTrCaocnet(r3i)buted Perl DLoocgu:m:eAnntya:t:iPornoxy::WithStackTrace(3)
2
3
4

NAME

6       Log::Any::Proxy::WithStackTrace - Log::Any proxy to upgrade string
7       errors to objects with stack traces
8

VERSION

10       version 1.714
11

SYNOPSIS

13         use Log::Any qw( $log, proxy_class => 'WithStackTrace' );
14
15         # Some adapter that knows how to handle both structured data,
16         # and log messages which are actually objects with a
17         # "stack_trace" method:
18         #
19         Log::Any::Adapter->set($adapter);
20
21         $log->error("Help!");   # stack trace gets automatically added
22

DESCRIPTION

24       Some log adapters, like Log::Any::Adapter::Sentry::Raven, are able to
25       take advantage of being passed message objects that contain a stack
26       trace.  However if a stack trace is not available, and fallback logic
27       is used to generate one, the resulting trace can be confusing if it
28       begins relative to where the log adapter was called, and not relative
29       to where the logging method was originally called.
30
31       With this proxy in place, if any logging method is called with a
32       message that is a non-reference scalar, that message will be upgraded
33       into a "Log::Any::MessageWithStackTrace" object with a "stack_trace"
34       method, and that method will return a trace relative to where the
35       logging method was called.  A string overload is provided on the object
36       to return the original message.
37
38       Important: This proxy should be used with a Log::Any::Adapter that is
39       configured to handle structured data.  Otherwise the object created
40       here will just get stringified before it can be used to access the
41       stack trace.
42

METHODS

44   maybe_upgrade_with_stack_trace
45       This is an internal use method that will convert a non-reference scalar
46       message into a "Log::Any::MessageWithStackTrace" object with a
47       "stack_trace" method.  A string overload is provided to return the
48       original message.
49

AUTHORS

51       •   Jonathan Swartz <swartz@pobox.com>
52
53       •   David Golden <dagolden@cpan.org>
54
55       •   Doug Bell <preaction@cpan.org>
56
57       •   Daniel Pittman <daniel@rimspace.net>
58
59       •   Stephen Thirlwall <sdt@cpan.org>
60
62       This software is copyright (c) 2017 by Jonathan Swartz, David Golden,
63       and Doug Bell.
64
65       This is free software; you can redistribute it and/or modify it under
66       the same terms as the Perl 5 programming language system itself.
67
68
69
70perl v5.36.0                      2023-03-22Log::Any::Proxy::WithStackTrace(3)
Impressum