Skip to content

Commit c3d6c8b

Browse files
committed
level_logger: update specs
1 parent cd5202e commit c3d6c8b

File tree

1 file changed

+50
-17
lines changed

1 file changed

+50
-17
lines changed

doc/specs/stdlib_logger.md

Lines changed: 50 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ title: logger
88
## Introduction
99

1010
This module defines a derived type, its methods, a variable, and
11-
constants to be used for the reporting of errors and other
12-
information. The derived type, `logger_type`, is to be used to define
13-
both global and local logger variables. The `logger_type` methods serve
14-
to configure the loggers and use the logger variables to report
15-
messages to a variable specific list of I/O units termed
16-
`log_units`. The variable, `global_logger`, of type `logger_type`, is
17-
intended to serve as the default global logger. The constants serve as
11+
constants to be used for the reporting of errors, for filtering the
12+
log messages, and other information. The derived type, `logger_type`,
13+
is to be used to define both global and local logger variables. The
14+
`logger_type` methods serve to configure the loggers and use the logger
15+
variables to report messages to a variable specific list of I/O units
16+
termed `log_units`. The variable, `global_logger`, of type `logger_type`,
17+
is intended to serve as the default global logger. The constants serve as
1818
error flags returned by the optional integer `stat` argument.
1919

2020
The logger variables have the option to:
2121

2222
* change which units receive the log messages;
2323
* report which units receive the log messages;
24+
* change the level for filtering the log messages;
2425
* precede messages by a blank line;
2526
* precede messages by a time stamp of the form
2627
`yyyy-mm-dd hh:mm:ss.sss`;
@@ -64,6 +65,17 @@ Error Code | Description
6465
`unopened_in_error` | the unit was not opened
6566
`write_fault` | one of the writes to `log_units` failed
6667

68+
The module also defines eight distinct public integer constants for
69+
filtering the log messages. These constants, termed severity levels, are
70+
(sorted following their increasing order of severity): `all_level`,
71+
`debug_level`, `information_level`, `warning_level`, `error_level`,
72+
`io_error_level`, `text_error_level`, and `none_level`.
73+
All log messages with a level lower than a specified severity level (e.g.,
74+
`information_level`) will be ignored. The levels `error_level`,
75+
`io_error_level`, and `text_error_level` have the same severity.
76+
The default severity level is `information_level`.
77+
78+
6779
## The derived type: logger_type
6880

6981
### Status
@@ -81,14 +93,15 @@ significant events encountered during the execution of a program.
8193

8294
### Private attributes
8395

84-
| Attribute | Type | Description | Initial value |
85-
|------------------|---------------|-------------------------------------------------|--------------|
86-
| `add_blank_line` | Logical | Flag to precede output with a blank line | `.false.` |
87-
| `indent_lines` | Logical | Flag to indent subsequent lines by four columns | `.true.` |
88-
| `log_units` | Integer array | List of I/O units used for output | Unallocated |
89-
| `max_width` | Integer | Maximum column width of output | 0 |
90-
| `time_stamp` | Logical | Flag to precede output by a time stamp | `.true.` |
91-
| `units` | Integer | Count of the number of active output units | 0 |
96+
| Attribute | Type | Description | Initial value |
97+
|------------------|---------------|-------------------------------------------------|---------------------|
98+
| `add_blank_line` | Logical | Flag to precede output with a blank line | `.false.` |
99+
| `indent_lines` | Logical | Flag to indent subsequent lines by four columns | `.true.` |
100+
| `level` | Integer | Severity level | `information_level` |
101+
| `log_units` | Integer array | List of I/O units used for output | Unallocated |
102+
| `max_width` | Integer | Maximum column width of output | 0 |
103+
| `time_stamp` | Logical | Flag to precede output by a time stamp | `.true.` |
104+
| `units` | Integer | Count of the number of active output units | 0 |
92105

93106
## The `stdlib_logger` variable
94107

@@ -284,7 +297,7 @@ Reports the configuration of a logger.
284297

285298
#### Syntax
286299

287-
`call self % [[logger_type(type):configuration(bound)]]( [ add_blankline, indent, max_width, time_stamp, log_units ] )`
300+
`call self % [[logger_type(type):configuration(bound)]]( [ add_blankline, indent, level, max_width, time_stamp, log_units ] )`
288301

289302
#### Class
290303

@@ -303,6 +316,10 @@ Pure subroutine
303316
is an `intent(out)` argument. A value of `.true.` indents subsequent
304317
lines by four spaces, and `.false.` otherwise.
305318

319+
`level` (optional): shall be a scalar default integer variable. It is an
320+
`intent(out)` argument. The value corresponds to the severity level for
321+
ignoring a message.
322+
306323
`max_width` (optional): shall be a scalar default integer
307324
variable. It is an `intent(out)` argument. A positive value bigger
308325
than four defines the maximum width of the output, otherwise there
@@ -355,7 +372,7 @@ Configures the logging process for self.
355372

356373
#### Syntax
357374

358-
`call self % [[logger_type(type):configure(bound)]]( [ add_blank_line, indent, max_width, time_stamp ] )`
375+
`call self % [[logger_type(type):configure(bound)]]( [ add_blank_line, indent, level, max_width, time_stamp ] )`
359376

360377
#### Class
361378

@@ -375,6 +392,10 @@ Pure subroutine
375392
indent subsequent lines by four spaces, and to `.false.` to
376393
not indent.
377394

395+
`level` (optional): shall be a scalar default integer expression. It is
396+
an `intent(in)` argument. Set the severity level for ignoring a log
397+
message.
398+
378399
`max_width` (optional): shall be a scalar default integer
379400
expression. It is an `intent(in)` argument. Set to a positive value
380401
bigger than four to define the maximum width of the output,
@@ -416,6 +437,8 @@ If time stamps are active, a time stamp is written, followed
416437
by `module` and `procedure` if present, and then
417438
`message` is written with the prefix `'DEBUG: '`.
418439

440+
It is ignored if the `level` of `self` is higher than `debug_level`.
441+
419442
#### Class
420443

421444
Subroutine
@@ -486,6 +509,8 @@ followed by `module` and `procedure` if present, then
486509
`message` is written with the prefix `'ERROR: '`, and then
487510
if `stat` or `errmsg` are present they are written.
488511

512+
It is ignored if the `level` of `self` is higher than `error_level`.
513+
489514
#### Class
490515

491516
Subroutine
@@ -569,6 +594,8 @@ If time stamps are active, a time stamp is written, followed
569594
by `module` and `procedure` if present, and then
570595
`message` is written with the prefix `'INFO: '`.
571596

597+
It is ignored if the `level` of `self` is higher than `information_level`.
598+
572599
#### Class
573600

574601
Subroutine
@@ -637,6 +664,8 @@ written. Then `message` is written with the prefix
637664
`'I/O ERROR: '`. Then if `iostat` or `iomsg` are present they are
638665
written.
639666

667+
It is ignored if the `level` of `self` is higher than `io_error_level`.
668+
640669
#### Syntax
641670

642671
`call self % [[logger_type(type):log_io_error(bound)]]( message [, module, procedure, iostat, iomsg ] )`
@@ -714,6 +743,8 @@ If time stamps are active, a time stamp is written,
714743
then `module` and `procedure` are written if present,
715744
followed by `prefix \\ ': '`, if present, and finally `message`.
716745

746+
No severity level is applied to `log_message`.
747+
717748
#### Syntax
718749

719750
`call self % [[logger_type(type):log_message(bound)]]( message [, module, procedure, prefix ] )`
@@ -790,6 +821,8 @@ written with `column`. Then `line` is written. Then a caret, '^', is
790821
written below `line` at the column indicated by `column`. Then
791822
`summary` is written below the caret.
792823

824+
It is ignored if the `level` of `self` is higher than `text_error_level`.
825+
793826
#### Syntax
794827

795828
`call self % [[logger_type(type):log_text_error(bound)]]( line, column, summary [, filename, line_number, caret, stat ] )`

0 commit comments

Comments
 (0)