On Thu, 5 Jan 2017 Nathan Bailey wrote: > Hi all (especially Andy :-) Hi Nathan :)
> What are you supposed to put in your non-main route handlers? > use Dancer2::Plugin::LogReport mode => 'DEBUG'; (like main route > handler); OR > use Log::Report; (like other modules) It depends if you want to use the "special" Dancer-specific keywords (such as process and success). If you don't, I would just use Log::Report; > I assume the later, however in all cases (with none or either of the > above), I had an error that Log::Report wouldn't report, ie. I had to > change my environment.yml back to logger: "File" to see it. It was a > missing dependency - I'd started using a function that I hadn't use'd > the module for. > > 'File' wrote: > [AppName::Module:PID] error @2017-01-05 14:47:42> Route exception: > Undefined subroutine &Mod::Mod::sub called at path/file.pm line 254. > in /Library/Perl/5.18/Dancer2/Core/App.pm l. 1441 > > in the log files, but 'LogReport' wrote nothing. I have to admit that I'd never tried using the module in such a way. I've just tried now, and I see what you mean. A very quick debug shows Dancer calling the Log::Report plugin (as it should) but with different parameters than it does for the main route handler. Strangely it seems to be passing details of a 404 error for the page that generates the exception. I don't have time to look at it right now; I'll make some time later, but if you want to have a look yourself in the meantime, then the key part of the plugin is in Plugin/LogReport.pm in $dsl->hook (init_error ... just after on_plugin_import; Andy _______________________________________________ dancer-users mailing list [email protected] http://lists.preshweb.co.uk/mailman/listinfo/dancer-users
