#2410 Setting log level for tests

elyashiv Tue 14 Apr 2015

When running the build script, I can set the -v option in order for it to print out more data. It will be nice if fant will have a similar option, allowing to set the logging level of the pod being tested.

SlimerDude Tue 14 Apr 2015

I'm not sure what it does, but fant does have a -v option:

C:\> fant -help
Fantom Test
Usage:
  fant [options] -all
  fant [options] <pod> [pod]*
  fant [options] <pod>::<test>
  fant [options] <pod>::<test>.<method>
  fant [options] filename
Options:
  -help, -h, -?  print usage help
  -version       print version
  -v             verbose mode
  -all           test all pods
  -js            test JavaScript environment

Or you could always wrap the call to fant in your own script:

myfant.fan

using [java]fanx.tools::Fant

class MyFant {
    Void main(Str[] args) {
        if (args.any { it == "-v" })
            Pod.find(args[-1]).log.level = LogLevel.debug
        Fant().run(args)
    }
}

and run it with:

C:\> fan myfant.fan -v engine

brian Tue 14 Apr 2015

It will be nice if fant will have a similar option

Interesting, so what exactly where you thinking? Like a command line option to control any log level? I personally find it easiest to just have a line my tests to turn on (or sometimes off logging) since I'm actually always working with the code itself

elyashiv Wed 15 Apr 2015

I think that a option for fant will be an easier (and not as dirty) solution to use.

Adding the option to fant will also allow to tests on pods you install to give more details about the failure of a test - allowing better bug reports.

You solution also requires to rebuild the pod, something that can take some time ( http://xkcd.com/303/ ).

Login or Signup to reply.