Provides five log levels (SILENT, ERROR, WARN, INFO, DEBUG) and routes
messages to stdout, an optional log file, or both. The module is safe to
use before log_init is called: it defaults to INFO level with no file.
Level constants (use these in namelist verbosity field):
LOGLVL_SILENT = 0 — suppress all output
LOGLVL_ERROR = 1 — errors only
LOGLVL_WARN = 2 — warnings and errors
LOGLVL_INFO = 3 — normal operational messages (default)
LOGLVL_DEBUG = 4 — developer diagnostics
Typical usage in the driver: @code call log_init(cfg % verbosity, cfg % log_file) call log_info('config: loaded "input.nml"') call log_warn('reconstruction: char_proj ignored on FDS path') call log_finalize() @endcode
| Type | Visibility | Attributes | Name | Initial | |||
|---|---|---|---|---|---|---|---|
| integer, | public, | parameter | :: | LOGLVL_SILENT | = | 0 |
Log level constants. Higher value = more verbose. Note: names use LOGLVL_ prefix to avoid case-insensitive clash with the log_error / log_warn / log_info / log_debug subroutines. |
| integer, | public, | parameter | :: | LOGLVL_ERROR | = | 1 | |
| integer, | public, | parameter | :: | LOGLVL_WARN | = | 2 | |
| integer, | public, | parameter | :: | LOGLVL_INFO | = | 3 | |
| integer, | public, | parameter | :: | LOGLVL_DEBUG | = | 4 | |
| integer, | private | :: | log_verbosity | = | LOGLVL_INFO | ||
| integer, | private | :: | log_file_unit | = | -1 | ||
| logical, | private | :: | log_file_open | = | .false. |
Initialise the logger: set verbosity level and optionally open a log file.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| integer, | intent(in) | :: | verbosity |
Threshold level (LOGLVL_SILENT … LOGLVL_DEBUG). |
||
| character(len=*), | intent(in) | :: | log_file |
Path for the log file. Empty string disables file logging. |
Close the log file and reset file-logging state.
Emit an ERROR-level message.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | msg |
Emit a WARN-level message.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | msg |
Emit an INFO-level message.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | msg |
Emit a DEBUG-level message.
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | msg |
| Type | Intent | Optional | Attributes | Name | ||
|---|---|---|---|---|---|---|
| character(len=*), | intent(in) | :: | tag | |||
| character(len=*), | intent(in) | :: | msg | |||
| integer, | intent(in) | :: | threshold |