|
1 | 1 | # Flogger |
2 | 2 | > Quick and easy to use logging library for Modern Fortran applications |
3 | 3 |
|
4 | | -## Snippets |
| 4 | +## Features |
| 5 | + |
| 6 | +* Fast and lightweight logging library |
| 7 | +* Text highlighting |
| 8 | +* Log filtering |
| 9 | +* Save logs to logfile |
| 10 | + |
| 11 | +### Snippets / Examples |
5 | 12 |
|
6 | 13 | ```f90 |
7 | | -a bunch of code |
8 | | -``` |
9 | | -```sh |
10 | | -echo results |
| 14 | + type(FloggerUnit) :: flogs = FloggerUnit("levelClassificationTest") |
| 15 | + call flogs%debug("Message Test Debug 1") |
| 16 | + call flogs%info("Message Test Info 1") |
| 17 | + call flogs%notice("Message Test Notice 1") |
| 18 | + call flogs%warning("Message Test Warning 1") |
| 19 | + call flogs%error("Message Test Error 1") |
| 20 | + call flogs%fatal("Message Test Fatal 1") |
11 | 21 | ``` |
| 22 | + |
12 | 23 |
|
13 | 24 | ## Getting Started |
14 | 25 |
|
15 | | -### Manual Installation |
16 | | -1. Copy the whole repository to external library folder of the target project |
17 | | -2. Include library in `CMakeLists.txt` at the project root folder. |
| 26 | +1. `USE` the flogger module |
| 27 | + |
| 28 | + for every program scope, you need to `USE` the flogger module with this following command |
| 29 | + ```f90 |
| 30 | + USE Flogger |
| 31 | + ``` |
| 32 | +
|
| 33 | +2. Initiate the FloggerUnit with identifier |
| 34 | +
|
| 35 | + You can initialize multiple instances of `FloggerUnit` and give different labels for each unit. Here's how to initiate the `FloggerUnit` object |
| 36 | + ```f90 |
| 37 | + type(FloggerUnit) :: flogMain = FloggerUnit("ClassMainTest") |
| 38 | + type(FloggerUnit) :: flogMidDebug = FloggerUnit("MiddleDebug") |
| 39 | + type(FloggerUnit) :: flogMidWarning = FloggerUnit("MiddleWarning") |
| 40 | + ``` |
| 41 | +3. `call` the logging subroutines |
| 42 | +
|
| 43 | + To make the log message you need to call the object methods from the corresponding `FloggerUnit` instances as follows. |
| 44 | + ```f90 |
| 45 | + call flogs%debug("Message Test Debug 2") |
| 46 | + call flogs%notice("Message Test Notice 2") |
| 47 | + call flogMidWarning%warning("Message Test Warning 4") |
| 48 | + call flogMidWarning%error("Message Test Error 4") |
| 49 | + call flogMidDebug%fatal("Message Test Fatal 4") |
| 50 | + call flogMidDebug%info("Message Test Info 2") |
| 51 | + ``` |
| 52 | +
|
| 53 | +4. Set flogger options |
| 54 | +
|
| 55 | + Flogger logging behavior can be changed using `SET_FLOGGER_OPTIONS` subroutine. Here is the example |
| 56 | + ```f90 |
| 57 | + call SET_FLOGGER_OPTIONS(Level=FLOGS_SET_RELEASE) ! set to release mode |
| 58 | + call SET_FLOGGER_OPTIONS(Level=FLOGS_SET_SILENT) ! set to silent mode |
| 59 | + call SET_FLOGGER_OPTIONS(FileOutput=.true.) ! make flogger build logfiles |
| 60 | + ``` |
18 | 61 |
|
| 62 | +## Documentations |
| 63 | +*under development...* |
19 | 64 |
|
20 | 65 | ## Author |
21 | 66 | **Arif Y. Sunanhadikusuma (Soen)** <br> |
|
0 commit comments