37  use, 
intrinsic :: iso_fortran_env, only: stdout => output_unit, &
 
   46     integer :: section_id_
 
 
   79    class(
log_t), 
intent(inout) :: this
 
   80    character(len=255) :: log_level
 
   81    character(len=255) :: log_file
 
   87    call get_environment_variable(
"NEKO_LOG_LEVEL", log_level, envvar_len)
 
   88    if (envvar_len .gt. 0) 
then 
   89       read(log_level(1:envvar_len), *) this%level_
 
   94    call get_environment_variable(
"NEKO_LOG_FILE", log_file, envvar_len)
 
   95    if (envvar_len .gt. 0) 
then 
   97       open(unit = this%unit_, 
file = trim(log_file), status = 
'replace', &
 
 
  107    class(
log_t), 
intent(inout) :: this
 
  110       this%indent_ = this%indent_ + 1
 
 
  117    class(
log_t), 
intent(inout) :: this
 
  120       this%indent_ = this%indent_ - 1
 
 
  127    class(
log_t), 
intent(in) :: this
 
  131       write(this%unit_, 
'(A)', advance = 
'no') repeat(
' ', this%indent_)
 
 
  138    class(
log_t), 
intent(in) :: this
 
  139    integer, 
optional :: lvl
 
  143    if (
present(lvl)) 
then 
  149    if (lvl_ .gt. this%level_) 
then 
  154       write(this%unit_, 
'(A)') 
'' 
 
  161    class(
log_t), 
intent(in) :: this
 
  162    character(len=*), 
intent(in) :: msg
 
  163    integer, 
optional :: lvl
 
  166    if (
present(lvl)) 
then 
  172    if (lvl_ .gt. this%level_) 
then 
  178       write(this%unit_, 
'(A)') trim(msg)
 
 
  185    class(
log_t), 
intent(in) :: this
 
  186    character(len=*), 
intent(in) :: version
 
  187    character(len=*), 
intent(in) :: build_info
 
  190       write(this%unit_, 
'(A)') 
'' 
  191       write(this%unit_, 
'(1X,A)') 
'   _  __  ____  __ __  ____  ' 
  192       write(this%unit_, 
'(1X,A)') 
'  / |/ / / __/ / //_/ / __ \ ' 
  193       write(this%unit_, 
'(1X,A)') 
' /    / / _/  / ,<   / /_/ / ' 
  194       write(this%unit_, 
'(1X,A)') 
'/_/|_/ /___/ /_/|_|  \____/  ' 
  195       write(this%unit_, 
'(A)') 
'' 
  196       write(this%unit_, 
'(1X,A,A,A)') 
'(version: ', trim(version), 
')' 
  197       write(this%unit_, 
'(1X,A)') trim(build_info)
 
  198       write(this%unit_, 
'(A)') 
'' 
 
  205    class(
log_t), 
intent(in) :: this
 
  206    character(len=*), 
intent(in) :: msg
 
  210       write(stderr, 
'(A,A,A)') 
'*** ERROR: ', trim(msg), 
'  ***' 
 
  217    class(
log_t), 
intent(in) :: this
 
  218    character(len=*), 
intent(in) :: msg
 
  222       write(this%unit_, 
'(A,A,A)') 
'*** WARNING: ', trim(msg), 
'  ***' 
 
  229    class(
log_t), 
intent(inout) :: this
 
  230    character(len=*), 
intent(in) :: msg
 
  231    integer, 
optional :: lvl
 
  233    integer :: i, pre, pos
 
  236    if (
present(lvl)) 
then 
  242    if (lvl_ .gt. this%level_) 
then 
  248       this%indent_ = this%indent_ + this%section_id_
 
  249       this%section_id_ = this%section_id_ + 1
 
  251       pre = (30 - len_trim(msg)) / 2
 
  252       pos = 30 - (len_trim(msg) + pre)
 
  254       write(this%unit_, 
'(A)') 
'' 
  256       write(this%unit_, 
'(A,A,A)') &
 
  257            repeat(
'-', pre), trim(msg), repeat(
'-', pos)
 
 
  265    class(
log_t), 
intent(inout) :: this
 
  266    character(len=*), 
intent(in), 
optional :: msg
 
  267    integer, 
optional :: lvl
 
  270    if (
present(lvl)) 
then 
  276    if (lvl_ .gt. this%level_) 
then 
  280    if (
present(msg)) 
then 
  285       this%section_id_ = this%section_id_ - 1
 
  286       this%indent_ = this%indent_ - this%section_id_
 
 
  294    class(
log_t), 
intent(in) :: this
 
  295    real(kind=
rp), 
intent(in) :: t
 
  296    real(kind=
rp), 
intent(in) :: t_end
 
  297    character(len=LOG_SIZE) :: log_buf
 
  298    real(kind=
rp) :: t_prog
 
  300    t_prog = 100d0 * t / t_end
 
  301    write(log_buf, 
'(A4,E15.7,34X,A2,F6.2,A3)') 
't = ', t, 
'[ ', t_prog, 
'% ]' 
 
  316    use, 
intrinsic :: iso_c_binding
 
  317    character(kind=c_char), 
dimension(*), 
intent(in) :: c_msg
 
  318    character(len=LOG_SIZE) :: msg
 
  324          if (c_msg(len+1) .eq. c_null_char) 
exit 
  326          msg(len:len) = c_msg(len)
 
  330       write(
neko_log%unit_, 
'(A)') trim(msg(1:len))
 
 
  338    use, 
intrinsic :: iso_c_binding
 
  339    character(kind=c_char), 
dimension(*), 
intent(in) :: c_msg
 
  340    character(len=LOG_SIZE) :: msg
 
  346          if (c_msg(len+1) .eq. c_null_char) 
exit 
  348          msg(len:len) = c_msg(len)
 
  352       write(stderr, 
'(A,A,A)') 
'*** ERROR: ', trim(msg(1:len)), 
'  ***' 
 
  360    use, 
intrinsic :: iso_c_binding
 
  361    character(kind=c_char), 
dimension(*), 
intent(in) :: c_msg
 
  362    character(len=LOG_SIZE) :: msg
 
  368          if (c_msg(len+1) .eq. c_null_char) 
exit 
  370          msg(len:len) = c_msg(len)
 
  375            '*** WARNING: ', trim(msg(1:len)), 
'  ***' 
 
  383    use, 
intrinsic :: iso_c_binding
 
  384    character(kind=c_char), 
dimension(*), 
intent(in) :: c_msg
 
  385    character(len=LOG_SIZE) :: msg
 
  391          if (c_msg(len+1) .eq. c_null_char) 
exit 
  393          msg(len:len) = c_msg(len)
 
  396       call neko_log%section(trim(msg(1:len)))
 
 
Module for file I/O operations.
 
subroutine log_end_section_c()
End a log section (from C)
 
subroutine log_end(this)
Decrease indention level.
 
subroutine log_header(this, version, build_info)
Write the Neko header to a log.
 
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_begin(this)
Increase indention level.
 
subroutine log_message_c(c_msg)
Write a message to a log (from C)
 
subroutine log_end_section(this, msg, lvl)
End a log section.
 
subroutine log_init(this)
Initialize a log.
 
subroutine log_warning(this, msg)
Write a warning message to a log.
 
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_newline(this, lvl)
Write a new line to a log.
 
subroutine log_section_c(c_msg)
Begin a new log section (from C)
 
integer, parameter, public neko_log_debug
Debug log level.
 
subroutine log_status(this, t, t_end)
Write status banner.
 
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_section(this, msg, lvl)
Begin a new log section.
 
subroutine log_error(this, msg)
Write an error message to a log.
 
integer, parameter, public rp
Global precision used in computations.