[Dart-dev] [3783] DART/trunk/utilities: Make the printing of messages labeled E_DBG controllable by namelist.

nancy at ucar.edu nancy at ucar.edu
Tue Mar 3 11:27:37 MST 2009


An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20090303/2304d74c/attachment.html 
-------------- next part --------------
Modified: DART/trunk/utilities/utilities_mod.f90
===================================================================
--- DART/trunk/utilities/utilities_mod.f90	2009-02-27 17:59:40 UTC (rev 3782)
+++ DART/trunk/utilities/utilities_mod.f90	2009-03-03 18:27:35 UTC (rev 3783)
@@ -141,8 +141,10 @@
 character(len=129) :: logfilename = 'dart_log.out'
 character(len=129) :: nmlfilename = 'dart_log.nml'
 logical  :: module_details = .true.  ! print svn details about each module
+logical  :: print_debug    = .false. ! print messages labeled DBG
 
-namelist /utilities_nml/ TERMLEVEL, logfilename, module_details, nmlfilename
+namelist /utilities_nml/ TERMLEVEL, logfilename, module_details, &
+                         nmlfilename, print_debug
 
 contains
 
@@ -634,6 +636,26 @@
         write(logfileunit, *) trim(taskstr),': ',trim(routine),' ', trim(text)
       endif
 
+   case (E_DBG)
+      if (print_debug) then
+
+         ! what about do_output_flag?  want messages from all procs or just PE0?
+         if ( single_task ) then
+           write(     *     , *) 'DEBUG FROM: ', trim(routine),' ', trim(text)
+           write(logfileunit, *) 'DEBUG FROM: ', trim(routine),' ', trim(text)
+         else
+           if (task_number < 10) then
+               write(taskstr, '(a,i1)' ) "PE ", task_number
+           else if (task_number < 100) then
+               write(taskstr, '(a,i2)' ) "PE ", task_number
+           else
+               write(taskstr, '(a,i5)' ) "PE ", task_number
+           endif
+           write(     *     , *) trim(taskstr),': DEBUG FROM: ',trim(routine),' ', trim(text)
+           write(logfileunit, *) trim(taskstr),': DEBUG FROM: ',trim(routine),' ', trim(text)
+         endif
+      endif
+
    case (E_WARN)
 
       write(     *     , *) 'WARNING FROM:'

Modified: DART/trunk/utilities/utilities_mod.html
===================================================================
--- DART/trunk/utilities/utilities_mod.html	2009-02-27 17:59:40 UTC (rev 3782)
+++ DART/trunk/utilities/utilities_mod.html	2009-03-03 18:27:35 UTC (rev 3783)
@@ -659,18 +659,13 @@
  <P>We adhere to the F90 standard of starting a namelist with an ampersand
  '&#38;' and terminating with a slash '/'.
  <div class=namelist><pre>
- <em class=call>namelist / utilities_nml / </em> TERMLEVEL, logfilename, nmlfilename
-
-
+ <em class=call>namelist / utilities_nml / </em> TERMLEVEL, logfilename, nmlfilename,
+                                           module_details, print_debug
  </pre></div>
  <H3 class=indent1>Discussion</H3>
  <P>
-The namelist controls the way in which the error handler acts. In the
-default case, only calls with level E_ERR lead to program termination.
-If TERMLEVEL is set to E_WARN, then warnings or errors lead to 
-termination. If TERMLEVEL is set to E_ERR + 1, then even errors don't
-lead to termination (be careful doing this). 
- </em>
+The namelist controls how the logging, namelist, messages, and general
+utility routines behave.
  </P>
  <P>This namelist is read in a file called <em class=file>input.nml</em>
  </P>
@@ -681,10 +676,15 @@
  <TR><!--contents--><TD valign=top>TERMLEVEL</TD>
      <!--  type  --><TD valign=top>integer</TD>
      <!--descript--><TD valign=top>Level at which calls to error
-                        manager terminate program. <em class="unit">Default: E_ERR</em></TD></TR>
+                        manager terminate program.  The default setting is
+                        warnings and errors terminate the program. Setting
+                        this to 2 (E_ERR) means only errors terminate.
+                        Setting this to 3 means even errors do not cause an
+                        exit (which is not a good idea).
+                        <em class="unit">Default: 1 (E_WARN)</em></TD></TR>
  <TR><!--contents--><TD valign=top>logfilename</TD>
      <!--  type  --><TD valign=top>character(len=129)</TD>
-     <!--descript--><TD valign=top>File to which the logfile is written. 
+     <!--descript--><TD valign=top>File to which the log messages are written. 
                         <em class="unit">Default: dart_log.out</em></TD></TR>
  <TR><!--contents--><TD valign=top>nmlfilename</TD>
      <!--  type  --><TD valign=top>character(len=129)</TD>
@@ -698,6 +698,12 @@
                         Verbose, but useful for knowing what version of the
                         code was used during the run.
                         <em class="unit">Default: .true.</em></TD></TR>
+ <TR><!--contents--><TD valign=top>print_debug</TD>
+     <!--  type  --><TD valign=top>logical</TD>
+     <!--descript--><TD valign=top>Setting this to .true. causes additional
+                        debug messages to print. These can be very verbose
+                        and by default are turned off.
+                        <em class="unit">Default: .false.</em></TD></TR>
  </TABLE>
  <BR>
 

Modified: DART/trunk/utilities/utilities_mod.nml
===================================================================
--- DART/trunk/utilities/utilities_mod.nml	2009-02-27 17:59:40 UTC (rev 3782)
+++ DART/trunk/utilities/utilities_mod.nml	2009-03-03 18:27:35 UTC (rev 3783)
@@ -1,7 +1,8 @@
 &utilities_nml
-   TERMLEVEL = 1,
-   logfilename = 'dart_log.out',
-   nmlfilename = 'dart_log.nml',
-   module_details = .true.
+   TERMLEVEL      = 1,
+   logfilename    = 'dart_log.out',
+   nmlfilename    = 'dart_log.nml',
+   module_details = .true.,
+   print_debug    = .false.
 /
 


More information about the Dart-dev mailing list