aboutsummaryrefslogtreecommitdiff
path: root/captain/log.f90
blob: 3757faf4d51563964c94e607d3c44e8b976f1327 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
module logging
implicit none

    integer::logunit
    
contains

    subroutine initialize(filename)
    implicit none
    
        character(*), intent(in)::filename
        open(newunit=logunit, file=trim(filename), action="write", status="unknown", position="append")
        
    end subroutine initialize
    
    subroutine shutdown()
    implicit none
    
        close(logunit)
        
    end subroutine shutdown
    
    subroutine write_log(string)
    implicit none
    
        character(*), intent(in)::string
        
        ! GNU Extension... :(
        write(logunit, *) fdate()//" :: "//string
        call flush(logunit)
        
    end subroutine write_log

end module logging