File: dancer1.pl

package info (click to toggle)
liblog-report-perl 1.40-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 568 kB
  • sloc: perl: 2,905; makefile: 8
file content (24 lines) | stat: -rw-r--r-- 650 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env perl
# Daemon at localhost:3000

use Dancer;
use Dancer::Logger::LogReport;
use Log::Report import => 'dispatcher';

dispatcher FILE => 'logfile'     # open additional log destination
# , mode => 'DEBUG'              # extended information
  , to => '/tmp/dancer-demo.log';

dispatcher close => 'default';   # closes warn/die default dispatcher

set logger        => 'log_report';
set log           => 'debug';
set logger_format => 'LOG: %i%m';

get '/' => sub {
    error "we reached the log";   # use Dancer's error() syntax!
    notice "one more";            # additional levels, same syntax
    return "Hello World!\n";
};

start;