1Test2::EventFacet::TracUes(e3r)Contributed Perl DocumentTaetsito2n::EventFacet::Trace(3)
2
3
4
6 Test2::EventFacet::Trace - Debug information for events
7
9 The Test2::API::Context object, as well as all Test2::Event types need
10 to have access to information about where they were created. This
11 object represents that information.
12
14 use Test2::EventFacet::Trace;
15
16 my $trace = Test2::EventFacet::Trace->new(
17 frame => [$package, $file, $line, $subname],
18 );
19
21 $string = $trace->{details}
22 $string = $trace->details()
23 Used as a custom trace message that will be used INSTEAD of "at
24 <FILE> line <LINE>" when calling "$trace->debug".
25
26 $frame = $trace->{frame}
27 $frame = $trace->frame()
28 Get the call frame arrayref.
29
30 $int = $trace->{pid}
31 $int = $trace->pid()
32 The process ID in which the event was generated.
33
34 $int = $trace->{tid}
35 $int = $trace->tid()
36 The thread ID in which the event was generated.
37
38 $id = $trace->{cid}
39 $id = $trace->cid()
40 The ID of the context that was used to create the event.
41
42 $uuid = $trace->{uuid}
43 $uuid = $trace->uuid()
44 The UUID of the context that was used to create the event. (If uuid
45 tagging was enabled)
46
47 DISCOURAGED HUB RELATED FIELDS
48 These fields were not always set properly by tools. These are MOSTLY
49 deprecated by the Test2::EventFacet::Hub facets. These fields are not
50 required, and may only reflect the hub that was current when the event
51 was created, which is not necessarily the same as the hub the event was
52 sent through.
53
54 Some tools did do a good job setting these to the correct hub, but you
55 cannot always rely on that. Use the 'hubs' facet list instead.
56
57 $hid = $trace->{hid}
58 $hid = $trace->hid()
59 The ID of the hub that was current when the event was created.
60
61 $huuid = $trace->{huuid}
62 $huuid = $trace->huuid()
63 The UUID of the hub that was current when the event was created.
64 (If uuid tagging was enabled).
65
66 $int = $trace->{nested}
67 $int = $trace->nested()
68 How deeply nested the event is.
69
70 $bool = $trace->{buffered}
71 $bool = $trace->buffered()
72 True if the event was buffered and not sent to the formatter
73 independent of a parent (This should never be set when nested is 0
74 or "undef").
75
77 Note: All facet frames are also methods.
78
79 $trace->set_detail($msg)
80 $msg = $trace->detail
81 Used to get/set a custom trace message that will be used INSTEAD of
82 "at <FILE> line <LINE>" when calling "$trace->debug".
83
84 "detail()" is an alias to the "details" facet field for backwards
85 compatibility.
86
87 $str = $trace->debug
88 Typically returns the string "at <FILE> line <LINE>". If "detail"
89 is set then its value will be returned instead.
90
91 $trace->alert($MESSAGE)
92 This issues a warning at the frame (filename and line number where
93 errors should be reported).
94
95 $trace->throw($MESSAGE)
96 This throws an exception at the frame (filename and line number
97 where errors should be reported).
98
99 ($package, $file, $line, $subname) = $trace->call()
100 Get the caller details for the debug-info. This is where errors
101 should be reported.
102
103 $pkg = $trace->package
104 Get the debug-info package.
105
106 $file = $trace->file
107 Get the debug-info filename.
108
109 $line = $trace->line
110 Get the debug-info line number.
111
112 $subname = $trace->subname
113 Get the debug-info subroutine name.
114
115 $sig = trace->signature
116 Get a signature string that identifies this trace. This is used to
117 check if multiple events are related. The signature includes pid,
118 tid, file, line number, and the cid.
119
121 The source code repository for Test2 can be found at
122 http://github.com/Test-More/test-more/.
123
125 Chad Granum <exodist@cpan.org>
126
128 Chad Granum <exodist@cpan.org>
129
131 Copyright 2019 Chad Granum <exodist@cpan.org>.
132
133 This program is free software; you can redistribute it and/or modify it
134 under the same terms as Perl itself.
135
136 See http://dev.perl.org/licenses/
137
138
139
140perl v5.30.0 2019-09-06 Test2::EventFacet::Trace(3)