Ignore:
Timestamp:
May 22, 2019 9:52:13 AM (2 years ago)
Author:
kanani
Message:

clean up location, debug and error messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • palm/trunk/SOURCE/message.f90

    r3885 r3987  
    2525! -----------------
    2626! $Id$
     27! Improved formatting of job logfile output,
     28! changed output of DEBUG file
     29!
     30! 3885 2019-04-11 11:29:34Z kanani
    2731! Changes related to global restructuring of location messages and introduction
    2832! of additional debug messages
     
    123127    CHARACTER(LEN=*)   ::  routine_name                  !<
    124128    CHARACTER(LEN=200) ::  header_string                 !<
     129    CHARACTER(LEN=200) ::  header_string_2               !< for message ID and routine name
    125130    CHARACTER(LEN=200) ::  information_string_1          !<
    126131    CHARACTER(LEN=200) ::  information_string_2          !<
     
    151156    IF ( message_level == 0 )  THEN
    152157       header_string = '--- informative message' // TRIM(nest_string) //       &
    153                        ' ---  ID:'
     158                       ' ---'
    154159    ELSEIF ( message_level == 1 )  THEN
    155        header_string = '+++ warning message' // TRIM(nest_string) // ' ---  ID:'
     160       header_string = '+++ warning message' // TRIM(nest_string) // ' ---'
    156161    ELSEIF ( message_level == 2 )  THEN
    157        header_string = '+++ error message' // TRIM(nest_string) // ' ---  ID:'
     162       header_string = '+++ error message' // TRIM(nest_string) // ' ---'
    158163    ELSE
    159164       WRITE( header_string,'(A,I2)' )  '+++ unknown message level' //         &
     
    164169!
    165170!-- Add the message identifier and the generating routine
    166     header_string = TRIM( header_string ) // ' ' // message_identifier // &
    167                     '   generated by routine: ' // TRIM( routine_name )
     171    header_string_2 = 'ID: ' // message_identifier // &
     172                      '  generated by routine: ' // TRIM( routine_name )
    168173 
    169174    information_string_1 = 'Further information can be found at'
     
    203208!
    204209!--       Output on stdout
    205           WRITE( *, '(6X,A)' )  TRIM( header_string )
     210          WRITE( *, '(16X,A)' )  TRIM( header_string )
     211          WRITE( *, '(20X,A)' )  TRIM( header_string_2 )
    206212!
    207213!--       Cut message string into pieces and output one piece per line.
     
    210216          i = INDEX( message_string, '&' )
    211217          DO WHILE ( i /= 0 )
    212              WRITE( *, '(4X,A)' )  ADJUSTL( message_string(1:i-1) )
     218             WRITE( *, '(20X,A)' )  ADJUSTL( message_string(1:i-1) )
    213219             message_string = ADJUSTL( message_string(i+1:) )
    214220             i = INDEX( message_string, '&' )
    215221          ENDDO
    216           WRITE( *, '(10X,A)' )  ''
    217           WRITE( *, '(10X,A)' )  TRIM( message_string )
    218           WRITE( *, '(10X,A)' )  ''
    219           WRITE( *, '(10X,A)' )  TRIM( information_string_1 )
    220           WRITE( *, '(10X,A)' )  TRIM( information_string_2 )
    221           WRITE( *, '(10X,A)' )  ''
     222          WRITE( *, '(20X,A)' )  ''
     223          WRITE( *, '(20X,A)' )  TRIM( message_string )
     224          WRITE( *, '(20X,A)' )  ''
     225          WRITE( *, '(20X,A)' )  TRIM( information_string_1 )
     226          WRITE( *, '(20X,A)' )  TRIM( information_string_2 )
     227          WRITE( *, '(20X,A)' )  ''
    222228
    223229       ELSE
     
    286292
    287293    CHARACTER(LEN=*)  ::  location      !< text to be output on stdout
     294    CHARACTER(LEN=60) ::  location_string = ' '  !<
    288295    CHARACTER(LEN=*)  ::  message_type  !< attribute marking 'start' or 'end' of routine
    289296    CHARACTER(LEN=11) ::  message_type_string = ' '  !<
     
    305312       IF ( TRIM( message_type ) == 'finished' )  WRITE( message_type_string, * ) '-', TRIM( message_type ), '-'
    306313!
     314!--    Write dummy location_string in order to allow left-alignment of text despite the fixed (=A60)
     315!--    format.
     316       WRITE( location_string, * )  TRIM( location )
     317!
    307318!--    Write and flush debug location or info message to file
    308        WRITE( OUTPUT_UNIT, 200 )  TRIM( message_type_string ), TRIM( location ), TRIM( system_time )
     319       WRITE( OUTPUT_UNIT, 200 )  TRIM( message_type_string ), location_string, TRIM( system_time )
    309320       FLUSH( OUTPUT_UNIT )
    310321!
    311322!--    Message formats
    312 200    FORMAT ( 3X, A, '  ', A, ' | System time: ', A )
     323200    FORMAT ( 3X, A, ' ', A60, ' | System time: ', A )
    313324
    314325    ENDIF
     
    328339
    329340    USE control_parameters,                                                                        &
    330         ONLY:  current_timestep_number
     341        ONLY:  time_since_reference_point
    331342
    332343    IMPLICIT NONE
     
    353364!
    354365!-- Write and flush debug location or info message to file
    355     WRITE( debug_output_unit, 201 )    TRIM( system_time ), current_timestep_number, TRIM( message_type_string ), TRIM( debug_string )
     366    WRITE( debug_output_unit, 201 )    TRIM( system_time ), time_since_reference_point, TRIM( message_type_string ), TRIM( debug_string )
    356367    FLUSH( debug_output_unit )
    357368
    358369!
    359370!-- Message formats
    360 201 FORMAT ( 'System time: ', A, ' | timestep: ', I6, ' | ', A, ' ', A )
     371201 FORMAT ( 'System time: ', A, ' | simulated time (s): ', F12.3, ' | ', A, ' ', A )
    361372
    362373
Note: See TracChangeset for help on using the changeset viewer.