@@ -68,6 +68,15 @@ module stdlib_logger
68
68
unopened_in_error = 7 , &
69
69
write_failure = 8
70
70
71
+ integer , parameter , public :: &
72
+ stdlib_debug_level = 10 , &
73
+ stdlib_information_level = 20 , &
74
+ stdlib_warning_level = 30 , &
75
+ stdlib_error_level = 40 , &
76
+ stdlib_io_error_level = 40 , &
77
+ stdlib_text_error_level = 40
78
+
79
+
71
80
character (* ), parameter :: module_name = ' stdlib_logger'
72
81
73
82
type :: logger_type
@@ -78,6 +87,7 @@ module stdlib_logger
78
87
79
88
logical :: add_blank_line = .false.
80
89
logical :: indent_lines = .true.
90
+ integer :: level = stdlib_information_level
81
91
integer , allocatable :: log_units(:)
82
92
integer :: max_width = 0
83
93
logical :: time_stamp = .true.
@@ -806,6 +816,8 @@ subroutine log_debug( self, message, module, procedure )
806
816
! ! The name of the procedure contining the current invocation of
807
817
! ! `log_information`
808
818
819
+ if ( self % level > stdlib_debug_level) return
820
+
809
821
call self % log_message( message, &
810
822
module = module , &
811
823
procedure = procedure , &
@@ -877,6 +889,8 @@ subroutine log_error( self, message, module, procedure, stat, errmsg )
877
889
character (* ), parameter :: procedure_name = ' log_error'
878
890
character (:), allocatable :: suffix
879
891
892
+ if ( self % level > stdlib_error_level) return
893
+
880
894
if ( present (stat) ) then
881
895
write ( dummy, ' (a, i0)' , err= 999 , iostat= iostat, iomsg= iomsg ) &
882
896
new_line(' a' ) // " With stat = " , stat
@@ -957,6 +971,8 @@ subroutine log_information( self, message, module, procedure )
957
971
! ! The name of the procedure contining the current invocation of
958
972
! ! `log_information`
959
973
974
+ if ( self % level > stdlib_information_level) return
975
+
960
976
call self % log_message( message, &
961
977
module = module , &
962
978
procedure = procedure , &
@@ -1019,6 +1035,8 @@ subroutine log_io_error( self, message, module, procedure, iostat, &
1019
1035
character (* ), parameter :: procedure_name = ' log_io_error'
1020
1036
character (:), allocatable :: suffix
1021
1037
1038
+ if ( self % level > stdlib_io_error_level) return
1039
+
1022
1040
if ( present (iostat) ) then
1023
1041
write ( dummy, ' (a, i0)' , err= 999 , iostat= iostat2, iomsg= iomsg2 ) &
1024
1042
new_line(' a' ) // " With iostat = " , iostat
@@ -1237,6 +1255,8 @@ subroutine log_text_error( self, line, column, summary, filename, &
1237
1255
character (* ), parameter :: procedure_name = ' LOG_TEXT_ERROR'
1238
1256
character (len= :), allocatable :: buffer
1239
1257
1258
+ if ( self % level > stdlib_text_error_level) return
1259
+
1240
1260
acaret = optval(caret, ' ^' )
1241
1261
1242
1262
if ( column < 0 .or. column > len ( line ) + 1 ) then
0 commit comments