summaryrefslogtreecommitdiff
path: root/log.go
blob: 976ce91cc1fdd908a7dab1362b9e08cb80260335 (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
package main

import (
    "fmt"
    "time"
    "os"
)

var loud bool = true

func Log(text string) {
    //text := "Test"
    f, err := os.OpenFile("loghexfool", os.O_APPEND|os.O_WRONLY, 0600)
    if err != nil {
        panic(err)
    }

    defer f.Close()
    full := time.Now().String() + text
    if _, err = f.WriteString(full+"\n"); err != nil {
        panic(err)
    }
    if loud {
        fmt.Println("Log",full)
    }
}

//func main() {
//    Log("test2")
//}