[dancer-users] Changing configuration for testing

Gabor Szabo gabor at szabgab.com
Fri Nov 1 20:20:09 GMT 2013


> set log => 'warning'?

Is a good idea, but putting it in the test file does not have the
desired effect.
Specifically it said:    syntax error at t/002_index_route.t line 11,
near "set log"

I tried

use Dancer2;
set log => 'warning'?

in the test script. That at least ran, but I still got all the output.
The set statement
did not have any effect.


Having an environments/testing.yml  might a good idea, how do I tell
Dancer, in the test script to use that environment?


Finally,  I am not very satisfied with this, but I found a solution:

in the main pm file of the application I put:

if ($ENV{HARNESS_ACTIVE}) {
     set log  => "warning";
}

This will eliminate the extensive logging when running
"prove -l t/002_index_route.t"
and when running as
"make test"

but I still get the warnings when I run

plackup -L Shotgun bin/app.pl

which is good

and also when I run as:

  perl -Ilib t/002_index_route.t

which might be good as well, as then I can see the warnings if I really want it.

Gabor

On Fri, Nov 1, 2013 at 7:23 PM, Kovács Dávid [ Davs ]
<davserer at gmail.com> wrote:
> environments/testing.yml ?
>
>
> On Fri, Nov 1, 2013 at 3:09 PM, Nick Knutov <mail at knutov.com> wrote:
>>
>> set log => 'warning'?
>>
>>
>> 01.11.2013 19:49, Gabor Szabo пишет:
>> > In development.yml I have the default:
>> >
>> >    log: "core"
>> >
>> > which is good for development,  but when I run a
>> > test script it fills the screen unnecessarily.
>> >
>> > How can I set the log level to "warning" in the test script?
>> >
>> > Gabor


More information about the dancer-users mailing list