Skip to content

A wrapper for Fortran-stdlib logger, categorizing log messages and extending the feature by the operator chaining

License

Notifications You must be signed in to change notification settings

degawa/catechin

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

catechin

A wrapper for Fortran-stdlib logger, categorizing log messages and extending the feature by the operator chaining.

Motivation

I need log-message categorization, not detaied log leveling.

Getting started

Requirements

  • Modern Fortran compiler
    • The compilers and versions listed below have been used to develop catechin.
    • gfortran 11.2 bundled with quickstart Fortran on Windows
    • Intel Fortran Classic 2021.5.0 Build 20211109_000000
    • NAG Fortran 7.1 Build 7117
  • Fortran-stdlib
    • catechin is a wrapper for logger provided by the Fortran-stdlib.
  • Fortran Package Manager (fpm) 0.7.0 alpha
    • catechin is created as an fpm project.
  • test-drive 0.4.0
  • FORD (optional)

Get the code

To get the code, execute the following commnad:

git clone https://github.com/degawa/catechin.git
cd catechin

Build with fpm

To build the library using fpm, execute the following command:

fpm build

Then, install the library using:

fpm install --prefix path/to/your/libdir

Reference from your project

Add the following use statement to modules or procedures calling par-funnel.

use :: catechin

Reference as a fpm project's dependency

To use par-funnel in your fpm project, add the following to the fpm.toml.

[dependencies]
catechin = {git = "https://github.com/degawa/catechin.git"}

usage

catechin provides 2 logging subroutines.

  • logging(level, message, module, procedure, purpose, category)
  • logging(logger(purpose, level, category))
    • logger() can be extended using operators provided by catechin, like logging(logger(purpose, level, category) .in. module("module name") .in. procedure("procedure name") .message. "log message")

catechin uses several loggers for different purposes. The loggers can be configured via configure subroutine.

  • configure(purpose, level, timestamp, filename, stdout, log_unit, stat)
    • purpose: logger
    • level: log level
    • timestamp: flag to prepend the time stamp
    • filename: filename for logging of specific purpose
    • stdout: flag to write a log message to stdout when log messages are output to a file
    • log_unit: unit number opened to output log messages to a file
    • stat: status of configuration

examples

call logging(Lv%ERROR, "error", purpose=Pur%Trace, category="test.configure.level.warn")
! 2023-04-09 21:56:33.411: ERROR: [trace]: [test.configure.level.warn]: error
call logging(logger(Pur%Report, Lv%INFO, "category") .in.procedure("procedure") &
             .message."log message")
! 2023-04-09 21:58:28.859: procedure: INFO: [report]: [category]: log message

Todo

  • To add and refine unit tests.
  • To add docstrings.
  • To add procedure/operator for outputting variable in key-value format.

About

A wrapper for Fortran-stdlib logger, categorizing log messages and extending the feature by the operator chaining

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published