this is the logger module
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" |
custom logger data type
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 |
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 |
Close the log file, needs to be called at the end of the program
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(logger_type), | intent(inout) | :: | self |
Get the current logger verbosity configuration
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(logger_type), | intent(in) | :: | self | |||
integer(kind=default_int), | intent(out), | optional | :: | level |
Configure the logger to be a certain verbosity level
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(logger_type), | intent(inout) | :: | self | |||
integer(kind=default_int), | intent(in), | optional | :: | level |
Configure the logger to file to be a certain verbosity level
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(logger_type), | intent(inout) | :: | self | |||
character(len=*), | intent(in) | :: | filename | |||
integer(kind=default_int), | intent(in), | optional | :: | level |
Log a message that will only be printed at the debug level of verbosity
Type | Intent | Optional | 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 |
Log a message that will only be printed at the error of verbosity
Type | Intent | Optional | 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 |
Log a message that will only be printed at the info level of verbosity
Type | Intent | Optional | 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 |
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
Type | Intent | Optional | 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 |
Log a message that will only be printed at the performance of verbosity
Type | Intent | Optional | 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 |
Log a message that will only be printed at the verbose level of verbosity
Type | Intent | Optional | 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 |
Log a message that will only be printed at the warning level of verbosity
Type | Intent | Optional | 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 |
Internal subroutine that will write the message to the log no interface to the public
Type | Intent | Optional | 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 |