PerlDancer/Dancer2 — pull request #687 by DavsX (2014-09-12 13:39:02+00:00)
Title: Issue with Logger::File log_dir

Hi!
When the log_dir and the filename are _NOT_ specified for the Logger::File engine, it would build log_dir from it's 'location' attribute, which would call $self->app inside it's default value causing Dancer2 to die, because Logger::File has no reference to $app at all.

This PR adds those two attributes inside the options which are passed into D2::C::Factory inside Dancer2::Core::App's _build_logger_engine method. This way if we don't specify the log_dir and the filename in the config, the log_dir will be successfully built using $self->location and $self->environment.

The PR also extracts the trigger option in the log_dir to a separate method and adds a BUILD method inside Dancer2::Logger::File, which calls this method. The reason behind that is, that the Moo's builder does not execute the trigger (as stated in trigger's documentation: https://metacpan.org/pod/Moo#has ). This way if the log_dir is automatically build, the check for it's existence is not executed.