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 | :: | knowledge_level | = | 4 | |
| 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), non_overridable :: 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), non_overridable :: configuration | Get the current logger verbosity configuration. Usage: call my_logger%configuration(level) |
| procedure, public, pass(self), non_overridable :: configure | Configure the logger to be a certain verbosity level. Usage: call my_logger%configure(level) |
| procedure, public, pass(self), non_overridable :: 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), non_overridable :: 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), non_overridable :: 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), non_overridable :: 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), non_overridable :: knowledge | Log a message that will only be printed at the knowledge level of verbosity. Usage: call my_logger%knowledge(“MESSAGE”) |
| procedure, public, pass(self), non_overridable :: 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), non_overridable :: 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), non_overridable :: 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), non_overridable :: 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 |
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 |
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 |