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]
NAMELIST
  • PARAM_DC_LOG
    nametypedefault valuecomment
    LOG_LEVEL character(len=5) 'I'
    LOG_FILE character(len=100) "LOG_"

History Output
No history output

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.

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

Referenced by mod_rm_driver::scalerm(), and mod_rm_prep::scalerm_prep().

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  rewind(fid_conf)
106  read(fid_conf,nml=param_dc_log,iostat=ierr)
107 
108  if ( ierr > 0 ) then
109  call log('E', 'xxx Not appropriate names in namelist PARAM_DC_LOG. Check!')
110  end if
111 
112  if ( present(fid_log) ) then
113  log_fid = fid_log
114  log_file = ''
115  else
116  open( log_fid, & ! (out)
117  file = trim(log_file), & ! (in)
118  form = 'formatted', & ! (in)
119  iostat = ierr ) ! (in)
120  if ( ierr /= 0 ) then
121  call log('E', 'xxx File open error! :' // trim(log_file))
122  end if
123  log_opened = .true.
124  end if
125 
126  log_fid_nml = log_fid
127  if ( present(fid_nml) ) then
128  log_fid_nml = fid_nml
129  end if
130 
131 #if defined(PGI) || defined(SX)
132  if ( log_master_nml ) write(log_fid_nml,nml=param_dc_log)
133 #else
134  write(message,nml=param_dc_log)
135  call log_nml('I',message)
136 #endif
137 
138  select case (trim(log_level))
139  case ('E', 'e', 'ERROR', 'error')
140  log_ilevel = log_error
141  case ('W', 'w', 'WARN', 'warn')
142  log_ilevel = log_warn
143  case ('I', 'i', 'INFO', 'info')
144  log_ilevel = log_info
145  case ('D', 'd', 'DEBUG', 'debug')
146  log_ilevel = log_debug
147  case default
148  call log('E', 'xxx LOG_LEVEL is invalid. Check!')
149  end select
150 
151  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ logfinalize()

subroutine, public dc_log::logfinalize ( )

Definition at line 155 of file dc_log.f90.

References log_fid.

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

◆ log()

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

Definition at line 165 of file dc_log.f90.

References log_fid.

Referenced by dc_calendar::calendarinit(), gtool_file::fileattachbuffer(), gtool_file::fileclose(), gtool_file::filecreate(), gtool_file::filedefassociatedcoordinates(), gtool_file::filedefaxis(), gtool_file::filedefinevariable(), gtool_file::filedetachbuffer(), gtool_file::fileenddef(), gtool_file::fileflush(), gtool_file::filegetglobalattributetext(), gtool_file::filegetshape(), gtool_file::filemakefname(), gtool_file::fileopen(), gtool_file::filereadvar1drealdp(), gtool_file::filereadvar2drealdp(), gtool_file::filereadvar2drealsp(), gtool_file::filereadvar3drealdp(), gtool_file::filereadvar3drealsp(), gtool_file::filereadvar4drealdp(), gtool_file::filereadvar4drealsp(), gtool_file::filesetoption(), gtool_file::filesettattr(), gtool_file::filewrite1drealsp(), gtool_history::historyaddvariable(), gtool_history::historyoutputlist(), gtool_history::historyput1dassociatedcoordinatesdp(), gtool_history::historyput1dassociatedcoordinatessp(), gtool_history::historyput2dassociatedcoordinatesdp(), gtool_history::historyput2dassociatedcoordinatessp(), gtool_history::historyput3dassociatedcoordinatesdp(), gtool_history::historyput3dassociatedcoordinatessp(), gtool_history::historyput4dassociatedcoordinatesdp(), gtool_history::historyput4dassociatedcoordinatessp(), gtool_history::historyputaxisdp(), gtool_history::historyputaxissp(), gtool_history::historyquery(), gtool_history::historywrite(), and loginit().

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

References log_fid_nml.

Referenced by loginit().

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

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

49  integer, public :: LOG_fid

◆ log_fid_nml

integer, public dc_log::log_fid_nml

Definition at line 50 of file dc_log.f90.

Referenced by log_nml(), and loginit().

50  integer, public :: LOG_fid_nml