this function can be called to check if the logger would log a message with the given level from the given source you should use this function if you do direct logging (without using dbcsr_logger_log), or if you want to know if the generation of some costly log info is necessary
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
type(dbcsr_logger_type), | POINTER | :: | logger |
the logger you want to log in |
||
integer, | intent(in) | :: | level |
describes the of the message: dbcsr_fatal_level(3), dbcsr_failure_level(2), dbcsr_warning_level(1), dbcsr_note_level(0). |
FUNCTION dbcsr_logger_would_log(logger, level) RESULT(res)
!! this function can be called to check if the logger would log
!! a message with the given level from the given source
!! you should use this function if you do direct logging
!! (without using dbcsr_logger_log), or if you want to know if the generation
!! of some costly log info is necessary
TYPE(dbcsr_logger_type), POINTER :: logger
!! the logger you want to log in
INTEGER, INTENT(in) :: level
!! describes the of the message: dbcsr_fatal_level(3), dbcsr_failure_level(2), dbcsr_warning_level(1), dbcsr_note_level(0).
LOGICAL :: res
CHARACTER(len=*), PARAMETER :: routineN = 'dbcsr_logger_would_log', &
routineP = moduleN//':'//routineN
TYPE(dbcsr_logger_type), POINTER :: lggr
lggr => logger
IF (.NOT. ASSOCIATED(lggr)) lggr => dbcsr_get_default_logger()
IF (lggr%ref_count < 1) &
DBCSR_ABORT(routineP//" logger%ref_count<1")
res = level >= lggr%print_level
END FUNCTION dbcsr_logger_would_log