Skip to content

Develop an API for a STDLIB logging system #227

Closed
@wclodius2

Description

@wclodius2

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 or ERROR_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 and ERRMSG of the statement that prompted the log message;
  • follow a message with the IOSTAT and IOMSG of the I/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:

  1. Is the general outline of the proposal a good one?
  2. Is STDLIB ready for such a proposal at this time?
  3. Which should be the default logical unit for the logger: OUTPUT_UNIT or ERROR_UNIT?
  4. Should you be able to output to both OUTPUT_UNIT and ERROR_UNIT at the same time?
  5. How many output units should be supported at one time?
  6. Should output of the labels be determined by the name of the procedure, e.g., LOG_ERROR, LOG_WARNING, and LOG_INFO, or by a flag?
  7. Are there any other questions I am missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    implementationImplementation in experimental and submission of a PRtopic: IOCommon input/output related features

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions