- Timestamp:
- Dec 22, 2019, 1:10:51 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
dynamico_lmdz/simple_physics/phyparam/physics/logging.F90
r4199 r4206 1 1 MODULE logging 2 2 3 ! see also logging.h3 ! see also use_logging.h 4 4 ! macro LOGBUF accumulates log output into logging_buffer 5 ! flush_plugin points to a procedure pointer that typically prints all lines in the buffer and prepends tags6 ! This module provides a default implementation of flush_plugin but the top-level driver is welcome to override it.7 5 8 6 IMPLICIT NONE … … 10 8 PRIVATE 11 9 12 INTERFACE 10 INTERFACE ! Explicit interfaces for plugins 11 12 ! Plugin that typically prints all lines in the loggin buffer 'buf' and prepends tags (log level, timestamp, ...) 13 13 SUBROUTINE plugin(lev, tag, buf) 14 14 INTEGER, INTENT(IN) :: lev 15 15 CHARACTER(*), INTENT(IN) :: tag, buf(:) 16 16 END SUBROUTINE plugin 17 18 ! Plugin that writes into string 'line' information about the gridpoint of index 'index' 19 SUBROUTINE plugin_log_gridpoint(index, line) 20 INTEGER, INTENT(IN) :: index ! index of gridpoint 21 CHARACTER(*), INTENT(OUT) :: line 22 END SUBROUTINE plugin_log_gridpoint 23 17 24 END INTERFACE 18 25 19 PROCEDURE(plugin), POINTER :: flush_plugin => default_flush_plugin 26 ! This module provides a default implementation of flush_plugin but the top-level driver is welcome to override it. 27 PROCEDURE(plugin), POINTER :: flush_plugin => default_flush 28 29 ! The top-level driver MUST provide an implementation for log_gridpoint_plugin 30 PROCEDURE(plugin_log_gridpoint), POINTER :: log_gridpoint_plugin => NULL() 20 31 21 32 INTEGER, PARAMETER :: bufsize=10000 … … 24 35 INTEGER :: logging_lineno=0 25 36 26 INTEGER, PARAMETER, PUBLIC :: log_level_ dbg=0, log_level_info=137 INTEGER, PARAMETER, PUBLIC :: log_level_fatal=0, log_level_error=1, log_level_warn=2, log_level_info=3, log_level_dbg=4 27 38 28 PUBLIC :: logging_buf, logging_lineno, flush_log, flush_plugin 39 PUBLIC :: logging_buf, logging_lineno, flush_log, log_gridpoint, & 40 flush_plugin, log_gridpoint_plugin 29 41 30 42 CONTAINS … … 37 49 END SUBROUTINE flush_log 38 50 39 SUBROUTINE default_flush _plugin(lev, tag, buf)51 SUBROUTINE default_flush(lev, tag, buf) 40 52 INTEGER, INTENT(IN) :: lev 41 53 CHARACTER(*), INTENT(IN) :: tag, buf(:) … … 44 56 PRINT *, '[INFO ',tag,']', TRIM(buf(i)) 45 57 END DO 46 END SUBROUTINE default_flush_plugin 47 58 END SUBROUTINE default_flush 59 60 SUBROUTINE log_gridpoint(index) 61 INTEGER, INTENT(IN) :: index 62 logging_lineno = logging_lineno+1 63 CALL log_gridpoint_plugin(index, logging_buf(logging_lineno)) 64 END SUBROUTINE log_gridpoint 65 48 66 END MODULE logging
Note: See TracChangeset
for help on using the changeset viewer.