I have developed a Fortran code which has the following characteristics:
The code has become quite big. Even though at this stage I am trying to get the correct answer, speed of execution of the code is desired.
I was writing a text log file with tags such as ERROR: message
or INFO: message
so far. But writing too much information slows down the code. I know in Java development we use log4j library to efficiently write log files where we can switch on or off various levels of logging. So once the code is clean, we can switch off low level logs and just keep the high level logs.
I would like to know from other programmers what is the best way to handle this in Fortran 90+.
The easiest way would be to create an integer variable verbose
and read in its value at execution (from file or through command line). By doing this, you could create different levels:
It'd be simple to implement:
IF(verbose >= 1) CALL OutputError(message)
IF(verbose >= 2) CALL OutputInfo(message)
and so on.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With