44 integer :: section_id_
75 class(
log_t),
intent(inout) :: this
76 character(len=255) :: log_level
82 call get_environment_variable(
"NEKO_LOG_LEVEL", log_level, envvar_len)
83 if (envvar_len .gt. 0)
then
84 read(log_level(1:envvar_len), *) this%level_
93 class(
log_t),
intent(inout) :: this
96 this%indent_ = this%indent_ + 1
103 class(
log_t),
intent(inout) :: this
106 this%indent_ = this%indent_ - 1
113 class(
log_t),
intent(in) :: this
117 do i = 1, this%indent_
118 write(*,
'(A)', advance=
'no')
' '
135 class(
log_t),
intent(in) :: this
136 character(len=*),
intent(in) :: msg
137 integer,
optional :: lvl
140 if (
present(lvl))
then
146 if (lvl_ .gt. this%level_)
then
152 write(*,
'(A)') trim(msg)
159 class(
log_t),
intent(in) :: this
160 character(len=*),
intent(in) :: msg
164 write(*,
'(A,A,A)')
'*** ERROR: ', trim(msg),
' ***'
171 class(
log_t),
intent(in) :: this
172 character(len=*),
intent(in) :: msg
176 write(*,
'(A,A,A)')
'*** WARNING: ', trim(msg),
' ***'
183 class(
log_t),
intent(inout) :: this
184 character(len=*),
intent(in) :: msg
189 this%indent_ = this%indent_ + this%section_id_
190 this%section_id_ = this%section_id_ + 1
192 pre = (30 - len_trim(msg)) / 2
197 write(*,
'(A)', advance=
'no')
'-'
200 write(*,
'(A)', advance=
'no') trim(msg)
201 do i = 1, 30 - (len_trim(msg) + pre)
202 write(*,
'(A)', advance=
'no')
'-'
211 class(
log_t),
intent(inout) :: this
212 character(len=*),
intent(in),
optional :: msg
214 if (
present(msg))
then
219 this%section_id_ = this%section_id_ - 1
220 this%indent_ = this%indent_ - this%section_id_
228 class(
log_t),
intent(in) :: this
229 real(kind=
rp),
intent(in) :: t
230 real(kind=
rp),
intent(in) :: t_end
231 character(len=LOG_SIZE) :: log_buf
232 real(kind=
rp) :: t_prog
234 t_prog = 100d0 * t / t_end
236 call this%message(
'----------------------------------------------------------------', &
238 write(log_buf,
'(A,E15.7,A,F6.2,A)') &
239 't = ', t,
' [ ',t_prog,
'% ]'
242 call this%message(
'----------------------------------------------------------------', &
253 use,
intrinsic :: iso_c_binding
254 character(kind=c_char),
dimension(*),
intent(in) :: c_msg
255 character(len=LOG_SIZE) :: msg
261 if (c_msg(len+1) .eq. c_null_char)
exit
263 msg(len:len) = c_msg(len)
267 write(*,
'(A)') trim(msg(1:len))
275 use,
intrinsic :: iso_c_binding
276 character(kind=c_char),
dimension(*),
intent(in) :: c_msg
277 character(len=LOG_SIZE) :: msg
283 if (c_msg(len+1) .eq. c_null_char)
exit
285 msg(len:len) = c_msg(len)
289 write(*,
'(A,A,A)')
'*** ERROR: ',trim(msg(1:len)),
' ***'
297 use,
intrinsic :: iso_c_binding
298 character(kind=c_char),
dimension(*),
intent(in) :: c_msg
299 character(len=LOG_SIZE) :: msg
305 if (c_msg(len+1) .eq. c_null_char)
exit
307 msg(len:len) = c_msg(len)
311 write(*,
'(A,A,A)')
'*** WARNING: ',trim(msg(1:len)),
' ***'
319 use,
intrinsic :: iso_c_binding
320 character(kind=c_char),
dimension(*),
intent(in) :: c_msg
321 character(len=LOG_SIZE) :: msg
327 if (c_msg(len+1) .eq. c_null_char)
exit
329 msg(len:len) = c_msg(len)
332 call neko_log%section(trim(msg(1:len)))
subroutine log_end_section_c()
End a log section (from C)
subroutine log_newline
Write a new line to a log.
subroutine log_status(this, t, T_end)
Write status banner.
subroutine log_end(this)
Decrease indention level.
integer, parameter, public neko_log_verbose
Verbose log level.
subroutine log_message(this, msg, lvl)
Write a message to a log.
integer, parameter, public neko_log_quiet
Always logged.
subroutine log_section(this, msg)
Begin a new log section.
subroutine log_begin(this)
Increase indention level.
subroutine log_message_c(c_msg)
Write a message to a log (from C)
subroutine log_init(this)
Initialize a log.
subroutine log_warning(this, msg)
Write a warning message to a log.
subroutine log_end_section(this, msg)
End a log section.
subroutine log_error_c(c_msg)
Write an error message to a log (from C)
subroutine log_indent(this)
Indent a log.
subroutine log_warning_c(c_msg)
Write a warning message to a log (from C)
subroutine log_section_c(c_msg)
Begin a new log section (from C)
integer, parameter, public neko_log_debug
Debug log level.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
integer, parameter, public neko_log_info
Default log level.
subroutine log_error(this, msg)
Write an error message to a log.
integer, parameter, public rp
Global precision used in computations.