SCALE-RM
Functions/Subroutines | Variables
dc_log Module Reference

module DC_Log More...

Functions/Subroutines

subroutine, public loginit (fid_conf, fid_log, master, fid_nml, master_nml)
 
subroutine, public logfinalize
 
subroutine, public log (type, message)
 
subroutine, public log_nml (type, message)
 

Variables

integer, parameter, public log_lmsg = 4096
 
integer, public log_fid
 
integer, public log_fid_nml
 

Detailed Description

module DC_Log

Description
Handring Log
Author
Team SCALE
History
  • 2012-07-12 (S.Nishizawa) [new]

Function/Subroutine Documentation

◆ loginit()

subroutine, public dc_log::loginit ( integer, intent(in)  fid_conf,
integer, intent(in), optional  fid_log,
logical, intent(in), optional  master,
integer, intent(in), optional  fid_nml,
logical, intent(in), optional  master_nml 
)

Definition at line 75 of file dc_log.f90.

75  implicit none
76  integer, intent(in) :: fid_conf
77  integer, intent(in), optional :: fid_log
78  logical, intent(in), optional :: master
79  integer, intent(in), optional :: fid_nml
80  logical, intent(in), optional :: master_nml
81 
82  character(len=5) :: LOG_LEVEL = 'I'
83  character(len=100) :: LOG_FILE = "LOG_"
84 
85  integer :: ierr
86 
87  namelist / param_dc_log / &
88  log_level, &
89  log_file
90 
91  character(len=LOG_LMSG) :: message
92  !-----------------------------------------------------------------------------
93 
94  log_fid = stdout
95  log_fid_nml = stdout
96  log_master = .true.
97 
98  if ( present(master) ) log_master = master
99  log_master_nml = log_master
100  if ( present(master_nml) ) log_master_nml = master_nml
101 
102  call date_and_time(log_file(4:11), log_file(12:21))
103 
104  !--- read PARAM
105  if ( fid_conf > 0 ) then
106  rewind(fid_conf)
107  read(fid_conf,nml=param_dc_log,iostat=ierr)
108  if ( ierr > 0 ) then
109  call log('E', 'xxx Not appropriate names in namelist PARAM_DC_LOG. Check!')
110  end if
111  end if
112 
113  if ( present(fid_log) ) then
114  log_fid = fid_log
115  log_file = ''
116  else
117  open( log_fid, & ! (out)
118  file = trim(log_file), & ! (in)
119  form = 'formatted', & ! (in)
120  iostat = ierr ) ! (in)
121  if ( ierr /= 0 ) then
122  call log('E', 'xxx File open error! :' // trim(log_file))
123  end if
124  log_opened = .true.
125  end if
126 
127  log_fid_nml = log_fid
128  if ( present(fid_nml) ) then
129  log_fid_nml = fid_nml
130  end if
131 
132 #if defined(PGI) || defined(SX)
133  if ( log_master_nml ) write(log_fid_nml,nml=param_dc_log)
134 #else
135  write(message,nml=param_dc_log)
136  call log_nml('I',message)
137 #endif
138 
139  select case (trim(log_level))
140  case ('E', 'e', 'ERROR', 'error')
141  log_ilevel = log_error
142  case ('W', 'w', 'WARN', 'warn')
143  log_ilevel = log_warn
144  case ('I', 'i', 'INFO', 'info')
145  log_ilevel = log_info
146  case ('D', 'd', 'DEBUG', 'debug')
147  log_ilevel = log_debug
148  case default
149  call log('E', 'xxx LOG_LEVEL is invalid. Check!')
150  end select
151 
152  return

References log(), log_fid, log_fid_nml, and log_nml().

Here is the call graph for this function:

◆ logfinalize()

subroutine, public dc_log::logfinalize

Definition at line 156 of file dc_log.f90.

156 
157  if ( log_opened ) close(log_fid)
158  log_opened = .false.
159 

References log_fid.

◆ log()

subroutine, public dc_log::log ( character(len=*), intent(in)  type,
character(len=*), intent(in)  message 
)

Definition at line 166 of file dc_log.f90.

166  implicit none
167  character(len=*), intent(in) :: type
168  character(len=*), intent(in) :: message
169 
170  select case (trim(type))
171  case ('E', 'e')
172  if ( log_ilevel >= log_error ) call logput(message)
173  write(stderr,*) trim(message)
174  call abort
175  case ('W', 'w')
176  if ( log_ilevel >= log_warn ) call logput(message)
177  case ('I', 'i')
178  if ( log_ilevel >= log_info ) call logput(message)
179  case ('D', 'd')
180  if ( log_ilevel >= log_debug ) call logput(message)
181  case default
182  write(stderr,*) 'BUG: wrong log level'
183  call abort
184  end select
185 
186  return

References log_fid.

Referenced by dc_calendar::calendarinit(), and loginit().

Here is the caller graph for this function:

◆ log_nml()

subroutine, public dc_log::log_nml ( character(len=*), intent(in)  type,
character(len=*), intent(in)  message 
)

Definition at line 204 of file dc_log.f90.

204  implicit none
205  character(len=*), intent(in) :: type
206  character(len=*), intent(in) :: message
207 
208  select case (trim(type))
209  case ('E', 'e')
210  if ( log_ilevel >= log_error ) call logput_nml(message)
211  write(stderr,*) trim(message)
212  call abort
213  case ('W', 'w')
214  if ( log_ilevel >= log_warn ) call logput_nml(message)
215  case ('I', 'i')
216  if ( log_ilevel >= log_info ) call logput_nml(message)
217  case ('D', 'd')
218  if ( log_ilevel >= log_debug ) call logput_nml(message)
219  case default
220  write(stderr,*) 'BUG: wrong log level'
221  call abort
222  end select
223 
224  return

References log_fid_nml.

Referenced by loginit().

Here is the caller graph for this function:

Variable Documentation

◆ log_lmsg

integer, parameter, public dc_log::log_lmsg = 4096

Definition at line 48 of file dc_log.f90.

48  integer, public, parameter :: LOG_LMSG = 4096

◆ log_fid

integer, public dc_log::log_fid

Definition at line 49 of file dc_log.f90.

49  integer, public :: LOG_fid

Referenced by log(), logfinalize(), and loginit().

◆ log_fid_nml

integer, public dc_log::log_fid_nml

Definition at line 50 of file dc_log.f90.

50  integer, public :: LOG_fid_nml

Referenced by log_nml(), and loginit().