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 |
Close the log file, needs to be called at the end of the program. Usage: call my_logger%close_log_file()
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. Usage: call my_logger%configuration(level)
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. Usage: call my_logger%configure(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. Usage: call my_logger%configure_file_output(filename, 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. Usage: call my_logger%debug(“MESSAGE”)
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 level of verbosity. Usage: call my_logger%error(“MESSAGE”)
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. Usage: call my_logger%info(“MESSAGE”)
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 knowledge level of verbosity. Usage: call my_logger%knowledge(“MESSAGE”)
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 performance level of verbosity. Usage: call my_logger%performance(“MESSAGE”)
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. Usage: call my_logger%verbose(“MESSAGE”)
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. Usage: call my_logger%warning(“MESSAGE”)
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 |
Processes the message and filters it according to the verbosity level set by the user or the default
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 |
type :: logger_type !! custom logger data type private integer(default_int), public :: log_level = info_level !! set default log level to info integer(default_int), public :: log_file_level = verbose_level !! set default log file log level to verbose integer(default_int), private :: log_file_unit = -1 logical, private :: log_file_open = .false. contains 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 :: 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 :: 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 :: 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 :: 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 :: 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 :: warning !! Log a message that will only be printed at the warning level of verbosity. !! Usage: call my_logger%warning("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 :: knowledge !! Log a message that will only be printed at the knowledge level of verbosity. !! Usage: call my_logger%knowledge("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 end type logger_type