pic_logger Module

this is the logger module


Uses

  • module~~pic_logger~~UsesGraph module~pic_logger pic_logger module~pic_global_definitions pic_global_definitions module~pic_logger->module~pic_global_definitions module~pic_types pic_types module~pic_logger->module~pic_types module~pic_global_definitions->module~pic_types iso_fortran_env iso_fortran_env module~pic_types->iso_fortran_env

Variables

Type Visibility Attributes Name Initial
integer(kind=default_int), public, parameter :: debug_level = 10
integer(kind=default_int), public, parameter :: error_level = 5
type(logger_type), public :: global_logger
integer(kind=default_int), public, parameter :: info_level = 8
integer(kind=default_int), public, parameter :: performance_level = 7
integer(kind=default_int), public, parameter :: verbose_level = 9
integer(kind=default_int), public, parameter :: warning_level = 6
character(len=*), private, parameter :: name = "pic_logger"

Derived Types

type, public ::  logger_type

custom logger data type

Components

Type Visibility Attributes Name Initial
integer(kind=default_int), public :: log_file_level = verbose_level

set default log file log level to verbose

integer(kind=default_int), public :: log_level = info_level

set default log level to info

logical, private :: log_file_open = .false.
integer(kind=default_int), private :: log_file_unit = -1

Type-Bound Procedures

procedure, public, pass(self) :: close_log_file

Close the log file, needs to be called at the end of the program. Usage: call my_logger%close_log_file()

procedure, public, pass(self) :: configuration

Get the current logger verbosity configuration. Usage: call my_logger%configuration(level)

procedure, public, pass(self) :: configure

Configure the logger to be a certain verbosity level. Usage: call my_logger%configure(level)

procedure, public, pass(self) :: configure_file_output

Configure the logger to file to be a certain verbosity level. Usage: call my_logger%configure_file_output(filename, level)

procedure, public, pass(self) :: debug

Log a message that will only be printed at the debug level of verbosity. Usage: call my_logger%debug(“MESSAGE”)

procedure, public, pass(self) :: error

Log a message that will only be printed at the error level of verbosity. Usage: call my_logger%error(“MESSAGE”)

procedure, public, pass(self) :: info

Log a message that will only be printed at the info level of verbosity. Usage: call my_logger%info(“MESSAGE”)

procedure, public, pass(self) :: performance

Log a message that will only be printed at the performance level of verbosity. Usage: call my_logger%performance(“MESSAGE”)

procedure, public, pass(self) :: verbose

Log a message that will only be printed at the verbose level of verbosity. Usage: call my_logger%verbose(“MESSAGE”)

procedure, public, pass(self) :: warning

Log a message that will only be printed at the warning level of verbosity. Usage: call my_logger%warning(“MESSAGE”)

procedure, private, pass(self) :: log

Processes the message and filters it according to the verbosity level set by the user or the default


Subroutines

private subroutine close_log_file(self)

Close the log file, needs to be called at the end of the program

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(inout) :: self

private pure subroutine configuration(self, level)

Get the current logger verbosity configuration

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(in) :: self
integer(kind=default_int), intent(out), optional :: level

private pure subroutine configure(self, level)

Configure the logger to be a certain verbosity level

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(inout) :: self
integer(kind=default_int), intent(in), optional :: level

private subroutine configure_file_output(self, filename, level)

Configure the logger to file to be a certain verbosity level

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(inout) :: self
character(len=*), intent(in) :: filename
integer(kind=default_int), intent(in), optional :: level

private subroutine debug(self, message, module, procedure)

Log a message that will only be printed at the debug level of verbosity

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(in) :: self
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: module
character(len=*), intent(in), optional :: procedure

private subroutine error(self, message, module, procedure)

Log a message that will only be printed at the error of verbosity

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(in) :: self
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: module
character(len=*), intent(in), optional :: procedure

private subroutine info(self, message, module, procedure)

Log a message that will only be printed at the info level of verbosity

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(in) :: self
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: module
character(len=*), intent(in), optional :: procedure

private subroutine log(self, level, message, module, procedure)

internal subroutines that processes the message and filters it according to the verbosity level set by the user or the default this is a private subroutine so it is not exposed to the user

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(in) :: self
character(len=*), intent(in) :: level
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: module
character(len=*), intent(in), optional :: procedure

private subroutine performance(self, message, module, procedure)

Log a message that will only be printed at the performance of verbosity

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(in) :: self
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: module
character(len=*), intent(in), optional :: procedure

private subroutine verbose(self, message, module, procedure)

Log a message that will only be printed at the verbose level of verbosity

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(in) :: self
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: module
character(len=*), intent(in), optional :: procedure

private subroutine warning(self, message, module, procedure)

Log a message that will only be printed at the warning level of verbosity

Read more…

Arguments

Type IntentOptional Attributes Name
class(logger_type), intent(in) :: self
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: module
character(len=*), intent(in), optional :: procedure

private subroutine write_log_line(unit, level, message, module, procedure)

Internal subroutine that will write the message to the log no interface to the public

Arguments

Type IntentOptional Attributes Name
integer(kind=default_int), intent(in) :: unit
character(len=*), intent(in) :: level
character(len=*), intent(in) :: message
character(len=*), intent(in), optional :: module
character(len=*), intent(in), optional :: procedure