Plack-Middleware-Log-Contextual
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:integrate Log::Contextual with PSGI middlware
NAME
    Plack::Middleware::Log::Contextual - integrate Log::Contextual with
    Plack/PSGI logger middleware

SYNOPSIS
      # in your PSGI web application
      use Log::Contextual qw(:log);

      log_info  { "Information" };
      log_fatal { "ZOMG this shouldn't happen: " . $self->dump_stuff };

      # standalone mode
      use Plack::Builder;
      use Log::Dispatchouli;

      my $ld = Log::Dispatchouli->new(...);

      builder {
          enable "Log::Contextual", logger => $ld;
          $app;
      };

      # PSGI logger mode
      use Plack::Builder;

      builder {
          enable "ConsoleLogger"; # should come before Log::Contextual
          enable "Log::Contextual";
          $app;
      };

DESCRIPTION
    Plack::Middleware::Log::Contextual is a PSGI middleware component that
    integrates Log::Contextual with your application. It works as a
    standalone and could also be used in combination with a PSGI logger
    framework.

CONFIGURATION
  Standalone mode
    You can use Log::Contextual as a standalone, meaning you can configure
    the logger object by yourself in the PSGI setup, and all the logging
    calls get propagated to the logger object you configured.

      use Plack::Builder;
      use Log::Log4perl qw(:easy);
      Log::Log4perl->easy_init(...);

      my $logger = Log::Log4perl->get_logger;

      builder {
          enable "Log::Contextual", logger => $logger;
          $psgi_app;
      };

  PSGI logger mode
    This middleware also works with the middleware components that support
    "psgix.logger" extension, such as Plack::Middleware::SimpleLogger,
    Plack::Middleware::LogDispatch or Plack::Middleware::ConsoleLogger.

      use Plack::Builder;

      builder {
          enable "ConsoleLogger";
          enable "Log::Contextual", level => "debug";
          $psgi_app;
      };

    Note that the PSGI logger should be applied before this middleware
    ("psgix.logger" is set by the other middleware, and used by this one).

    Unlike the standalone mode where you configure the minimum (and maximum)
    level in the logger, you should configure the minimum "level" in the
    middleware configuration as shown above. It defaults to "debug".

    Note that the specifications for "psgix.logger" state that the supported
    levels are ONLY debug, info, warn, error and fatal. If your application
    emits messages at different levels than these, it is recommended that
    you pass the logger object directly to this middleware, to bypass the
    "psgix.logger" coderef (see "Standalone mode"), or limit your use of log
    levels to those that overlap (for example for Log::Dispatch, only emit
    messages with the levels debug, info, warn and error, avoiding notice,
    critical, alert and emergency).

AUTHOR
    Tatsuhiko Miyagawa 

COPYRIGHT
    Copyright 2011- Tatsuhiko Miyagawa

LICENSE
    This library is free software; you can redistribute it and/or modify it
    under the same terms as Perl itself.

SEE ALSO
    Log::Contextual Plack PSGI::Extensions


本源码包内暂不包含可直接显示的源代码文件,请下载源码包。