Coder Social home page Coder Social logo

degawa / catechin Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 58 KB

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

License: MIT License

Fortran 100.00%
fortran fortran-library fortran-package-manager logger logging user-defined-operators wrapper

catechin's Introduction

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.

catechin's People

Contributors

degawa avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.