Subject: [UFL-dev] Add output method to ufl.log.begin?

From: Johan Hake <[email-masked]>
Date: Mon, 17 Aug 2009 12:57:47 +0200

Hello!

I want to get back the nice

  "Calling FFC just-in-time (JIT) compiler, this may take some time..."

message when jit compiling a form. I see that when I add a

  set_log_level(INFO)

in jit_form I get a bunch of uninteresting information:

Compiler stage 1: Analyzing form
--------------------------------                                                                   
                                                                                                   
Compiler stage 2: Computing form representation(s)                                                 
--------------------------------------------------                                                 
  Computing quadrature representation.                                                             
                                                                                                   
...

After some research I found out that this comes from the begin(), end() 
statements in ffc.analyze_form. As it is now begin just uses info when it 
present the information. 

Could we let begin take a level, like:

  begin(DEBUG,"Compiler stage 1: Analyzing form")

or if this is too verbose, provide a set_begin_level, which the begin function 
could use. With alternative 1 we have:

  begin(DEBUG,"Compiler stage 1: Analyzing form")
  debug("Jada")
  debug("Bada")
  end()

  begin(DEBUG,"Compiler stage 2: Computing form representation(s)")
  debug("Jada")
  debug("Bada")
  end()

  ...

and with alternative 2 we have:

  set_begin_level(DEBUG)
  begin("Compiler stage 1: Analyzing form")
  debug("Jada")
  debug("Bada")
  end()

  begin("Compiler stage 2: Computing form representation(s)")
  debug("Jada")
  debug("Bada")
  end()

I go for alternative 1.

Johan