1Dancer::Logger::CaptureU(s3e)r Contributed Perl DocumentaDtainocner::Logger::Capture(3)
2
3
4
6 Dancer::Logger::Capture - Capture dancer logs
7
9 version 1.3400
10
12 set logger => "capture";
13
14 my $trap = Dancer::Logger::Capture->trap;
15 my $logs = $trap->read;
16
18 This is a logger class for Dancer which captures all logs to an object.
19
20 Its primary purpose is for testing.
21
22 Methods
23 trap
24
25 Returns the Dancer::Logger::Capture::Trap object used to capture and
26 read logs.
27
29 use Test::More import => ['!pass'], tests => 2;
30 use Dancer;
31
32 set logger => 'capture';
33
34 warning "Danger! Warning!";
35 debug "I like pie.";
36
37 my $trap = Dancer::Logger::Capture->trap;
38 is_deeply $trap->read, [
39 { level => "warning", message => "Danger! Warning!" },
40 { level => "debug", message => "I like pie.", }
41 ];
42
43 # each call to read cleans the trap
44 is_deeply $trap->read, [];
45
47 Dancer::Logger, Dancer::Logger::Capture::Trap
48
50 Dancer Core Developers
51
53 This software is copyright (c) 2010 by Alexis Sukrieh.
54
55 This is free software; you can redistribute it and/or modify it under
56 the same terms as the Perl 5 programming language system itself.
57
58
59
60perl v5.28.0 2018-06-15 Dancer::Logger::Capture(3)