-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmain.go
41 lines (32 loc) · 770 Bytes
/
main.go
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
package main
import (
"os"
"github.com/fabiodcorreia/catch-my-file/pkg/catchmyfile"
"github.com/fabiodcorreia/catch-my-file/pkg/clog"
)
const port = 8822
func main() {
/*
// To monitor the application
go func() {
var ms runtime.MemStats
for {
runtime.ReadMemStats(&ms)
clog.Info("Memory: %d - Goroutines: %d", ms.Sys, runtime.NumGoroutine())
time.Sleep(5 * time.Second)
}
}()
*/
app := catchmyfile.New(port)
defer clog.Close()
clog.Info("========== Catch My File - Started ==========")
clog.Info("Logging to file: %s", clog.LogFile())
if err := app.Run(); err != nil {
clog.Error(err)
if cErr := clog.Close(); cErr != nil {
os.Exit(2)
}
os.Exit(1)
}
clog.Info("========== Catch My File - Finish ===========")
}