(git:6a2e663)
cp_log_handling Module Reference

various routines to log and control the output. The idea is that decisions about where to log should not be done in the code that generates the log, but should be globally changeable a central place. So some care has been taken to have enough information about the place from where the log comes so that in the future intelligent and flexible decisions can be taken by the logger, without having to change other code. More...

Functions/Subroutines

integer function, public cp_default_logger_stack_size ()
 ... More...
 
subroutine, public cp_add_default_logger (logger)
 adds a default logger. MUST be called before logging occours More...
 
subroutine, public cp_rm_default_logger ()
 the cousin of cp_add_default_logger, decrements the stack, so that the default logger is what it has been More...
 
type(cp_logger_type) function, pointer, public cp_get_default_logger ()
 returns the default logger More...
 
subroutine, public cp_logger_create (logger, para_env, print_level, default_global_unit_nr, default_local_unit_nr, global_filename, local_filename, close_global_unit_on_dealloc, iter_info, close_local_unit_on_dealloc, suffix, template_logger)
 initializes a logger More...
 
subroutine, public cp_logger_retain (logger)
 retains the given logger (to be called to keep a shared copy of the logger) More...
 
subroutine, public cp_logger_release (logger)
 releases this logger More...
 
logical function, public cp_logger_would_log (logger, level)
 this function can be called to check if the logger would log a message with the given level from the given source you should use this function if you do direct logging (without using cp_logger_log), or if you want to know if the generation of some costly log info is necessary More...
 
integer function, public cp_logger_get_unit_nr (logger, local)
 returns the unit nr for the requested kind of log. More...
 
integer function, public cp_logger_get_default_io_unit (logger)
 returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs calling this function is not the ionode More...
 
subroutine, public cp_logger_set_log_level (logger, level)
 changes the logging level. Log messages with a level less than the one given wo not be printed. More...
 
recursive integer function, public cp_logger_get_default_unit_nr (logger, local, skip_not_ionode)
 asks the default unit number of the given logger. try to use cp_logger_get_unit_nr More...
 
subroutine, public cp_logger_generate_filename (logger, res, root, postfix, local)
 generates a unique filename (ie adding eventual suffixes and process ids) More...
 
subroutine, public cp_logger_set (logger, local_filename, global_filename)
 sets various attributes of the given logger More...
 

Variables

integer, parameter, public cp_fatal_level = 3
 
integer, parameter, public cp_failure_level = 2
 
integer, parameter, public cp_warning_level = 1
 
integer, parameter, public cp_note_level = 0
 

Detailed Description

various routines to log and control the output. The idea is that decisions about where to log should not be done in the code that generates the log, but should be globally changeable a central place. So some care has been taken to have enough information about the place from where the log comes so that in the future intelligent and flexible decisions can be taken by the logger, without having to change other code.

Note
contains also routines to convert to a string. in my idea they should have been with variable length, (i.e. they should have returned a trim(adjustl(actual_result))) As a logger should be robust, at the moment I have given up.

At the moment logging and output refer to the same object (cp_logger_type) as these are actually different it might be better to separate them (they have already separate routines in a separate module

See also
cp_output_handling).

some practices (use of print *, no cp_error_type, manual retain release of some objects) are dictated by the need to have minimal dependency

History
08.2002 major update: retain, release, printkeys, para_env, local logging [fawzi] 02.2004 made a stack of default loggers [Joost VandeVondele]
See also
cp_error_handling
Author
Fawzi Mohamed
Version
12.2001

Function/Subroutine Documentation

◆ cp_default_logger_stack_size()

integer function, public cp_log_handling::cp_default_logger_stack_size

...

Returns
...
Author
fawzi

Definition at line 172 of file cp_log_handling.F.

Here is the caller graph for this function:

◆ cp_add_default_logger()

subroutine, public cp_log_handling::cp_add_default_logger ( type(cp_logger_type), intent(inout), target  logger)

adds a default logger. MUST be called before logging occours

Parameters
logger...
Author
Fawzi Mohamed
Note
increments a stack of default loggers the latest one will be available within the program

Definition at line 187 of file cp_log_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_rm_default_logger()

subroutine, public cp_log_handling::cp_rm_default_logger

the cousin of cp_add_default_logger, decrements the stack, so that the default logger is what it has been

Author
Joost VandeVondele

Definition at line 212 of file cp_log_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_get_default_logger()

type(cp_logger_type) function, pointer, public cp_log_handling::cp_get_default_logger

returns the default logger

Returns
...
History
4.2002 created [fawzi]
Author
Fawzi Mohamed
Note
initializes the default loggers if necessary

Definition at line 233 of file cp_log_handling.F.

◆ cp_logger_create()

subroutine, public cp_log_handling::cp_logger_create ( type(cp_logger_type), pointer  logger,
type(mp_para_env_type), optional, pointer  para_env,
integer, intent(in), optional  print_level,
integer, intent(in), optional  default_global_unit_nr,
integer, intent(in), optional  default_local_unit_nr,
character(len=*), intent(in), optional  global_filename,
character(len=*), intent(in), optional  local_filename,
logical, intent(in), optional  close_global_unit_on_dealloc,
type(cp_iteration_info_type), optional, pointer  iter_info,
logical, intent(in), optional  close_local_unit_on_dealloc,
character(len=*), intent(in), optional  suffix,
type(cp_logger_type), optional, pointer  template_logger 
)

initializes a logger

Parameters
loggerthe logger to initialize
para_envthe parallel environment (this is most likely the global parallel environment
print_levelthe level starting with which something is written (defaults to cp_note_level)
default_global_unit_nrthe default unit_nr for output (if not given, and no file is given defaults to the standard output)
default_local_unit_nrthe default unit number for local (i.e. task) output. If not given defaults to a out.taskid file created upon
global_filenamea new file to open (can be given instread of the global_unit_nr)
local_filenamea new file to open (with suffix and para_envmepos appended). Can be given instread of the default_local_unit_nr). the file is created only upon the first local logging request
close_global_unit_on_deallocif the unit should be closed when the logger is deallocated (defaults to true if a local_filename is given, to false otherwise)
iter_info...
close_local_unit_on_deallocif the unit should be closed when the logger is deallocated (defaults to true)
suffixthe suffix that should be added to all the generated filenames
template_loggera logger from where to take the unspecified things
History
4.2002 created [fawzi]
Author
Fawzi Mohamed
Note
the handling of *_filename, default_*_unit_nr, close_*_unit_on_dealloc tries to take the right decision with different inputs, and thus is a little complex.

Definition at line 281 of file cp_log_handling.F.

Here is the caller graph for this function:

◆ cp_logger_retain()

subroutine, public cp_log_handling::cp_logger_retain ( type(cp_logger_type), intent(inout)  logger)

retains the given logger (to be called to keep a shared copy of the logger)

Parameters
loggerthe logger to retain
History
08.2002 created [fawzi]
Author
Fawzi Mohamed

Definition at line 404 of file cp_log_handling.F.

Here is the caller graph for this function:

◆ cp_logger_release()

subroutine, public cp_log_handling::cp_logger_release ( type(cp_logger_type), pointer  logger)

releases this logger

Parameters
loggerthe logger to release
History
4.2002 created [fawzi]
Author
Fawzi Mohamed

Definition at line 422 of file cp_log_handling.F.

Here is the caller graph for this function:

◆ cp_logger_would_log()

logical function, public cp_log_handling::cp_logger_would_log ( type(cp_logger_type), pointer  logger,
integer, intent(in)  level 
)

this function can be called to check if the logger would log a message with the given level from the given source you should use this function if you do direct logging (without using cp_logger_log), or if you want to know if the generation of some costly log info is necessary

Parameters
loggerthe logger you want to log in
leveldescribes the of the message: cp_fatal_level(3), cp_failure_level(2), cp_warning_level(1), cp_note_level(0).
Returns
...
History
4.2002 revised [fawzi]
Author
Fawzi Mohamed

Definition at line 467 of file cp_log_handling.F.

Here is the call graph for this function:

◆ cp_logger_get_unit_nr()

integer function, public cp_log_handling::cp_logger_get_unit_nr ( type(cp_logger_type), pointer  logger,
logical, intent(in), optional  local 
)

returns the unit nr for the requested kind of log.

Parameters
loggerthe logger you want to log in
localif true returns a local logger (one per task), otherwise returns a global logger (only the process with para_envmepos== para_envsource should write to the global logger). Defaults to false
Returns
...
History
4.2002 revised [fawzi]
Author
Fawzi Mohamed

Definition at line 497 of file cp_log_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_logger_get_default_io_unit()

integer function, public cp_log_handling::cp_logger_get_default_io_unit ( type(cp_logger_type), optional, pointer  logger)

returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs calling this function is not the ionode

Parameters
loggerthe logger you want to log in
Returns
...
History
12.2009 created [tlaino]
Author
Teodoro Laino

Definition at line 514 of file cp_log_handling.F.

Here is the call graph for this function:

◆ cp_logger_set_log_level()

subroutine, public cp_log_handling::cp_logger_set_log_level ( type(cp_logger_type), intent(inout)  logger,
integer, intent(in)  level 
)

changes the logging level. Log messages with a level less than the one given wo not be printed.

Parameters
loggerthe logger to change
levelthe new logging level for the logger
History
4.2002 revised [fawzi]
Author
Fawzi Mohamed

Definition at line 543 of file cp_log_handling.F.

◆ cp_logger_get_default_unit_nr()

recursive integer function, public cp_log_handling::cp_logger_get_default_unit_nr ( type(cp_logger_type), optional, pointer  logger,
logical, intent(in), optional  local,
logical, intent(in), optional  skip_not_ionode 
)

asks the default unit number of the given logger. try to use cp_logger_get_unit_nr

Parameters
loggerthe logger you want info from
localif you want the local unit nr (defaults to false)
skip_not_ionode...
Returns
...
History
4.2002 revised [fawzi]
Author
Fawzi Mohamed

Definition at line 566 of file cp_log_handling.F.

Here is the call graph for this function:

◆ cp_logger_generate_filename()

subroutine, public cp_log_handling::cp_logger_generate_filename ( type(cp_logger_type), pointer  logger,
character(len=*), intent(inout)  res,
character(len=*), intent(in)  root,
character(len=*), intent(in)  postfix,
logical, intent(in), optional  local 
)

generates a unique filename (ie adding eventual suffixes and process ids)

Parameters
logger...
resthe resulting string
rootthe start of filename
postfixthe end of the name
localif the name should be local to this task (defaults to false)
History
08.2002 created [fawzi]
Author
Fawzi Mohamed
Note
this should be a function returning a variable length string. All spaces are moved to the end of the string. Not fully optimized: result must be a little longer than the resulting compressed filename

Definition at line 677 of file cp_log_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ cp_logger_set()

subroutine, public cp_log_handling::cp_logger_set ( type(cp_logger_type), intent(inout)  logger,
character(len=*), intent(in), optional  local_filename,
character(len=*), intent(in), optional  global_filename 
)

sets various attributes of the given logger

Parameters
loggerthe logger you want to change
local_filenamethe root of the name of the file used for local logging
global_filenamethe root of the name of the file used for global logging
Author
Fawzi Mohamed

Definition at line 716 of file cp_log_handling.F.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cp_fatal_level

integer, parameter, public cp_log_handling::cp_fatal_level = 3

Definition at line 81 of file cp_log_handling.F.

◆ cp_failure_level

integer, parameter, public cp_log_handling::cp_failure_level = 2

Definition at line 83 of file cp_log_handling.F.

◆ cp_warning_level

integer, parameter, public cp_log_handling::cp_warning_level = 1

Definition at line 85 of file cp_log_handling.F.

◆ cp_note_level

integer, parameter, public cp_log_handling::cp_note_level = 0

Definition at line 87 of file cp_log_handling.F.