NAME

Dancer2::Logger::LogReport - reroute Dancer2 logs into Log::Report

INHERITANCE

Dancer2::Logger::LogReport
  is a Moo::Object

SYNOPSIS

# This module is loaded when configured.  It does not provide
# end-user functions or methods.

DESCRIPTION

This logger allows the use of the many logging backends available in Log::Report. It will process all of the Dancer2 log messages, and also allow any other module to use the same logging facilities. The same log messages can be sent to multiple destinations at the same time via flexible dispatchers.

If using this logger, you may also want to use Dancer2::Plugin::LogReport

Many log back-ends, like syslog, have more levels of system messages. Modules who explicitly load this module can use the missing assert, notice, panic, and alert log levels. The trace name is provided as well: when you are debugging, you add a 'trace' to your program... it's just a better name than 'debug'.

You probably want to set a very simple logger_format, because the dispatchers do already add some of the fields that the default simple format adds. For instance, to get the filename/line-number in messages depends on the dispatcher 'mode' (f.i. 'DEBUG').

You also want to set the log level to debug, because level filtering is controlled per dispatcher (as well).

METHODS

$obj->log($level, $params)

DETAILS

Configuration

The setting logger should be set to LogReport in order to use this logging engine in a Dancer application. See Dancer2::Config about ways to include these settings in your program.

There is only one optional configuration parameter: dispatchers. This defines the Log::Report dispatchers to use. Any number of dispatchers may be configured.

# instruct Dancer2 to load this module
logger: LogReport

# use default Log::Report dispatchers
engines:
  logger:
    LogReport:

# syslog and file dispatcher
engines:
  logger:
    LogReport:
      logger_format: %i%m            # keep it simple
      dispatchers:
        syslog:                      # Name
          type: SYSLOG               # Log::Report dispatcher type
          identity: gads             # Dispatcher options
          facility: local0
          flags: "pid ndelay nowait"
          mode: DEBUG
        default:                     # will replace default dispatcher
          type: FILE
          to: /var/log/mylog
          charset: utf-8
          accept: NOTICE-            # Only accept NOTICE and above

SEE ALSO

This module is part of Log-Report distribution version 1.06, built on June 15, 2015. Website: http://perl.overmeer.net/log-report/

LICENSE

Copyrights 2007-2015 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html