Description
It is common for a library of code to have the equivalent of one or more error logging modules. SLATEC has its XERROR codes, Futility has its ExceptionHandler.f90 and FileTypeLog.f90, and FLIBS has its reporting, m_logger, m_multilog, and m_exception modules. I propose that STDLIB have its own logger module that I propose naming STDLIB_LOGGER
. I propose that the logger have options to:
- be able to send the same text to multiple logical units;
- be able to configure which units receive the text;
- by default have one of those units be one of
OUTPUT_UNIT
orERROR_UNIT
; - precede messages by a blank line;
- precede messages by a time stamp of the form
yyyy-mm-dd hh:mm:ss.sss
; - precede a message with module and procedure names;
- follow a message with the
STAT
andERRMSG
of the statement that prompted the log message; - follow a message with the
IOSTAT
andIOMSG
of theI/O
statement that prompted the log message; - label a message with one of
'INFORMATION: '
,'WARNING: '
, or'ERROR: '
; - indent subsequent lines of the messages; and
- format the text to fit within a maximum column width.
The maximum number of logical units to be supported at one time is a minimum of two: one of either OUTPUT_UNIT
or ERROR_UNIT
and an additional formatted file, but by using an array of logical units it should be possible to support more, such as the five supported by SLATEC's XERROR. While the initial implementation will use Fortran's standard file interface through logical units, I hope to hide enough of the details that wrappers to the logical units can be deployed if desired. The above proposal prompts the following questions:
- Is the general outline of the proposal a good one?
- Is STDLIB ready for such a proposal at this time?
- Which should be the default logical unit for the logger:
OUTPUT_UNIT
orERROR_UNIT
? - Should you be able to output to both
OUTPUT_UNIT
andERROR_UNIT
at the same time? - How many output units should be supported at one time?
- Should output of the labels be determined by the name of the procedure, e.g.,
LOG_ERROR
,LOG_WARNING
, andLOG_INFO
, or by a flag? - Are there any other questions I am missing?