ComIn 0.5.1
ICON Community Interface
Loading...
Searching...
No Matches
comin_print.F90
Go to the documentation of this file.
1!> @file comin_print.F90
2!! @brief Utility functions for printing log messages.
3!
4! @authors 08/2021 :: ICON Community Interface <comin@icon-model.org>
5!
6! SPDX-License-Identifier: BSD-3-Clause
7!
8! See LICENSES for license information.
9! Where software is supplied by third parties, it is indicated in the
10! headers of the routines.
11!
13
14 USE comin_state, ONLY: state, &
20 & comin_severity_debug, comin_severity_info, &
21 & comin_severity_warning
23 USE iso_c_binding, ONLY: c_ptr
24
25 PUBLIC :: comin_print_debug
26 PUBLIC :: comin_print_info
27 PUBLIC :: comin_print_warning
28
29CONTAINS
30
31 !> Prints a debug message if the plugin has set log_debug (disabled per default)
32 !> The message will only be printed on process 0.
33 !! @ingroup fortran_interface
34 SUBROUTINE comin_print_debug(msg)
35 CHARACTER(LEN=*), INTENT(IN) :: msg
36
37 IF (comin_state_get_lstdout() .AND. comin_severity_debug >= comin_current_get_plugin_log_severity()) THEN
38 WRITE(comin_state_get_output_unit(), '(4a)') "DEBUG(", comin_current_get_plugin_name(), "): ", trim(msg)
39 END IF
40 END SUBROUTINE comin_print_debug
41
42 ! C-wrapper
43 SUBROUTINE comin_print_debug_c(msg) &
44 BIND(C, name="comin_print_debug")
45 TYPE(c_ptr), VALUE, INTENT(IN) :: msg
46
48 END SUBROUTINE comin_print_debug_c
49
50 !> Prints a info message if the plugin has set log_info (enabled per default)
51 !> The message will only be printed on process 0.
52 !! @ingroup fortran_interface
53 SUBROUTINE comin_print_info(msg)
54 CHARACTER(LEN=*), INTENT(IN) :: msg
55
56 IF (comin_state_get_lstdout() .AND. comin_severity_info >= comin_current_get_plugin_log_severity()) THEN
57 WRITE(comin_state_get_output_unit(), '(4a)') "INFO(", comin_current_get_plugin_name(), "): ", trim(msg)
58 END IF
59 END SUBROUTINE comin_print_info
60
61 ! C-wrapper
62 SUBROUTINE comin_print_info_c(msg) &
63 BIND(C, name="comin_print_info")
64 TYPE(c_ptr), VALUE, INTENT(IN) :: msg
65
67 END SUBROUTINE comin_print_info_c
68
69 !> Prints a warning if the plugin has set log_warning (enabled per default)
70 !> The message will only be printed on process 0.
71 !! @ingroup fortran_interface
72 SUBROUTINE comin_print_warning(msg)
73 CHARACTER(LEN=*), INTENT(IN) :: msg
74
75 IF (comin_state_get_lstdout() .AND. comin_severity_warning >= comin_current_get_plugin_log_severity()) THEN
76 WRITE(comin_state_get_output_unit(), '(4a)') "WARNING(", comin_current_get_plugin_name(), "): ", trim(msg)
77 END IF
78 END SUBROUTINE comin_print_warning
79
80 ! C-wrapper
81 SUBROUTINE comin_print_warning_c(msg) &
82 BIND(C, name="comin_print_warning")
83 TYPE(c_ptr), VALUE, INTENT(IN) :: msg
84
86 END SUBROUTINE comin_print_warning_c
87
88END MODULE comin_print
t_comin_log_severity comin_current_get_plugin_log_severity()
const char * comin_current_get_plugin_name()
The elements of this derived data type describe a 3rd party plugin.
subroutine, public comin_print_warning(msg)
Prints a warning if the plugin has set log_warning (enabled per default) The message will only be pri...
subroutine, public comin_print_debug(msg)
Prints a debug message if the plugin has set log_debug (disabled per default) The message will only b...
subroutine, public comin_print_info(msg)
Prints a info message if the plugin has set log_info (enabled per default) The message will only be p...
subroutine comin_print_warning_c(msg)
subroutine comin_print_debug_c(msg)
subroutine comin_print_info_c(msg)
type(t_comin_state), pointer, public state