summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--init.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/init.go b/init.go
new file mode 100644
index 0000000..612bb6d
--- /dev/null
+++ b/init.go
@@ -0,0 +1,27 @@
+package main
+
+import (
+	"log"
+	"os"
+)
+
+// Sets up logging before the main function executes
+func init() {
+	logfile, err := os.OpenFile("getwtxt.log", os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0600)
+	if err != nil {
+		log.Printf("Could not open log file: %v\n", err)
+	}
+
+	// Listen for the signal to close the log file
+	go func() {
+		<-closelog
+		log.Printf("Closing log file ...\n")
+		err = logfile.Close()
+		if err != nil {
+			log.Printf("Couldn't close log file: %v\n", err)
+		}
+	}()
+
+	log.SetOutput(logfile)
+
+}
96 - move treeshake to a new tools/ directory' href='/akkartik/mu/commit/tools/treeshake_all?h=main&id=c1d596f56a6f2198ea8ea1b0a90c613e919d891b'>c1d596f5 ^
6a28260f ^
c1d596f5 ^

c1d596f5 ^
c1d596f5 ^





de0e57d3 ^
c1d596f5 ^


ab837e8f ^


de0e57d3 ^
ab837e8f ^



c1d596f5 ^

de0e57d3 ^
c1d596f5 ^


8fa73360 ^



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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63