Skip to content

Commit

Permalink
✏️ edit readme and add getting started section
Browse files Browse the repository at this point in the history
  • Loading branch information
arifyunando committed Aug 30, 2023
1 parent 96ec490 commit 9ecead3
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 8 deletions.
61 changes: 53 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,66 @@
# Flogger
> Quick and easy to use logging library for Modern Fortran applications
## Snippets
## Features

* Fast and lightweight logging library
* Text highlighting
* Log filtering
* Save logs to logfile

### Snippets / Examples

```f90
a bunch of code
```
```sh
echo results
type(FloggerUnit) :: flogs = FloggerUnit("levelClassificationTest")
call flogs%debug("Message Test Debug 1")
call flogs%info("Message Test Info 1")
call flogs%notice("Message Test Notice 1")
call flogs%warning("Message Test Warning 1")
call flogs%error("Message Test Error 1")
call flogs%fatal("Message Test Fatal 1")
```
![snippets results](img/snippets.png)

## Getting Started

### Manual Installation
1. Copy the whole repository to external library folder of the target project
2. Include library in `CMakeLists.txt` at the project root folder.
1. `USE` the flogger module

for every program scope, you need to `USE` the flogger module with this following command
```f90
USE Flogger
```
2. Initiate the FloggerUnit with identifier
You can initialize multiple instances of `FloggerUnit` and give different labels for each unit. Here's how to initiate the `FloggerUnit` object
```f90
type(FloggerUnit) :: flogMain = FloggerUnit("ClassMainTest")
type(FloggerUnit) :: flogMidDebug = FloggerUnit("MiddleDebug")
type(FloggerUnit) :: flogMidWarning = FloggerUnit("MiddleWarning")
```
3. `call` the logging subroutines
To make the log message you need to call the object methods from the corresponding `FloggerUnit` instances as follows.
```f90
call flogs%debug("Message Test Debug 2")
call flogs%notice("Message Test Notice 2")
call flogMidWarning%warning("Message Test Warning 4")
call flogMidWarning%error("Message Test Error 4")
call flogMidDebug%fatal("Message Test Fatal 4")
call flogMidDebug%info("Message Test Info 2")
```
4. Set flogger options
Flogger logging behavior can be changed using `SET_FLOGGER_OPTIONS` subroutine. Here is the example
```f90
call SET_FLOGGER_OPTIONS(Level=FLOGS_SET_RELEASE) ! set to release mode
call SET_FLOGGER_OPTIONS(Level=FLOGS_SET_SILENT) ! set to silent mode
call SET_FLOGGER_OPTIONS(FileOutput=.true.) ! make flogger build logfiles
```
## Documentations
*under development...*
## Author
**Arif Y. Sunanhadikusuma (Soen)** <br>
Expand Down
Binary file added img/snippets.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9ecead3

Please sign in to comment.