Giter Site home page Giter Site logo

mojolicious-plugin-accesslog's People

Contributors

augensalat avatar chinaxing avatar dsteinbrunner avatar reneeb avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

mojolicious-plugin-accesslog's Issues

POD is not clear on how to use with Mojolicious (not Mojolicious::Lite)

Documentation says I should write:

# Mojolicious
$self->plugin(AccessLog => {log => '/var/log/mojo/access.log'});

But when I include the uname_helper setting as such:

sub startup {
    my $app = shift;
    $app->plugin(AccessLog => {
        log => '/dev/null',
        uname_helper => 'set_username',
    });
    $app->hook(around_action => sub {
        my ($next, $c, $action) = @_;
        $c->set_username('alex');
    });
}

...then I get this error:

Can't locate object method "set_username" via package "Web::Ctrl1"

...where Web::Ctrl1 is the name of my controller that contains the route handlers. Everything else works on my website, except this, which produces this error.

How do I fix it? The AccessLog's documentation is not clear on this.

Allow $c in log function

I'm doing this now: (which of course is not very nice)

{
  require Mojolicious::Plugin::AccessLog;
  no warnings 'redefine';
  my $hack = \&Mojolicious::Plugin::AccessLog::_log;
  *Mojolicious::Plugin::AccessLog::_log = sub {
    my($c, @args) = @_;
    local $main::LOG_KEY = $c->session('reference') || $c->session('username');
    MyLogger->log(info => $hack->($c, @args));
  };
}

$app->plugin('Mojolicious::Plugin::AccessLog' => log => sub {});

Is there a way you could add a "log" callback which gets $c passed on as well as the log message? Or would you consider taking a pull request for this feature?

forking worker API

Do you have an advice what's the best way to prevent forking workers logging twice?

Grateful for any insight you can provide.

Update CPAN

CPAN is still on version 0.004. When do you publish 0.005?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.