Module: Log#
Logging utilities
Name: mod_mupro_log
Depends on: mod_lib_base
Defined variables: None
Defined types: None
Defined subroutines:
mupro_print_variable
mupro_print_message
Defined Subroutines#
mupro_print_variable#
A generic interface for printing variables to the screen. You have several choices of subroutine interfaces that you may use.
Note: These interfaces are used to print data of type integer,variable,real
The content printed to the file does not contain time information
call mupro_print_variable(name,value1)
call mupro_print_variable(name,value1, filename)
call mupro_print_variable(name,value1, value2, filename)
call mupro_print_variable(name,value1, name2, ,value2, filename)
call mupro_print_variable(name,value1, value2, ,value3, filename)
call mupro_print_variable(name1,value1, name2, value2, name3, value3, filename)
call mupro_print_variable(name, value1, value2, value3, value4, value5,value6,filename)
Argument  | 
Type(Intent)  | 
Meaning  | 
|---|---|---|
name  | 
character(len=*)(IN)  | 
Name of the variable to be printed  | 
value  | 
int32/real64/logical(IN)  | 
Value of the variable to be printed  | 
filename  | 
character(len=*)(IN)  | 
Set log output to specified file  | 
mupro_print_message#
Print a string to the screen
call mupro_print_message(message, fill, position)
Argument  | 
Type(Intent)  | 
Meaning  | 
|---|---|---|
message  | 
character(len=*)(IN)  | 
The string to be printed  | 
fill  | 
character(len=1)(IN)  | 
The character to fill left over spaces  | 
position  | 
character(len=1)(IN)  | 
Pass ‘c’ for center, ‘r’ for right, ‘l’ for left align  | 
filename  | 
character(len=*), intent(in), optional  | 
Output log file path  | 
flag_time_in  | 
logical, intent(in), optional  | 
Determine whether to add time information to the log . Default true  | 
Usage#
Here are some examples of using the log module.
program main
  use mod_mupro_log
  use mod_lib_base
  use mod_print
  implicit none
  integer(kind=isp) t,p,k
  character(len=8) filename
  character(len=4) var1,var2,var3
  character(len=20) :: step
  integer(kind=idp) :: kt
  real(kind=rdp) :: realNumber
  filename ="test.txt"
  var1="tp:"
  var2="t:"
  var3="p:"
  t=10
  p=20
  k=30
  ! test mupro_print_variable to print data of type
  call mupro_print_variable(var2,t)
  call mupro_print_variable(var2,t,filename)
  call mupro_print_variable(var1,t,p,filename)
  call mupro_print_variable(var2,t,var3,p,filename)
  call mupro_print_variable(var1,t,p,k,filename)
  call mupro_print_variable(var1,t,var2,p,var3,k,filename)
  call mupro_print_variable(var1,t,p,k,t,p,k,filename)
  ! test mupro_print_message
  call mupro_print_message("something bad", "-", "c")
  call mupro_print_message("add a mupro_print_message test", "*","l")
end program main