summaryrefslogtreecommitdiff
path: root/log.go
diff options
context:
space:
mode:
authorNikolaus Gotsche <n@softwarefools.com>2017-09-26 02:50:04 +0200
committerNikolaus Gotsche <n@softwarefools.com>2017-09-26 02:50:04 +0200
commit3fd5c25226ecaed13687ab59d12b1dbb2a2f1344 (patch)
treec0167216a9cc22eadc0907e40aa8b69bee434924 /log.go
parent4a0b4a5c406e3b9da7d4f10d14ec87c3c173a4db (diff)
New Logger
Diffstat (limited to 'log.go')
-rw-r--r--log.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/log.go b/log.go
new file mode 100644
index 0000000..365989b
--- /dev/null
+++ b/log.go
@@ -0,0 +1,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(full)
+ }
+}
+
+//func main() {
+// Log("test2")
+//}