Skip to content

Identify route callback in log by name #2288

@s1037989

Description

@s1037989

"Routing to a callback" is a very common log entry that can often be difficult to identify which callback, specifically when routes are like this:

$r->get('/' => sub { $self->_method(shift, @args) });

Wondering if instead we can update Mojolicious:Routes L93:

$c->helpers->log->trace('Routing to a callback for route name ' . ($c->current_route || '/'));

Are there any situations where this log entry would be triggered but where $c->current_route wouldn't be set and '/' wouldn't be correct?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions