-
Notifications
You must be signed in to change notification settings - Fork 5
/
global_config.go
59 lines (48 loc) · 1.33 KB
/
global_config.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package dastard
import (
"log"
"os"
"time"
)
// Portnumbers structs can contain all TCP port numbers used by Dastard.
type Portnumbers struct {
RPC int
Status int
Trigs int
SecondaryTrigs int
Summaries int
}
// Ports globally holds all TCP port numbers used by Dastard.
var Ports Portnumbers
func setPortnumbers(base int) {
Ports.RPC = base
Ports.Status = base + 1
Ports.Trigs = base + 2
Ports.SecondaryTrigs = base + 3
Ports.Summaries = base + 4
}
// BuildInfo can contain compile-time information about the build
type BuildInfo struct {
Version string
Githash string
Date string
}
// Build is a global holding compile-time information about the build
var Build = BuildInfo{
Version: "0.3.4pre2",
Githash: "no git hash computed",
Date: "no build date computed",
}
// DastardStartTime is a global holding the time init() was run
var DastardStartTime time.Time
// ProblemLogger will log warning messages to a file
var ProblemLogger *log.Logger
// UpdateLogger will log client updates to a file
var UpdateLogger *log.Logger
func init() {
setPortnumbers(5500)
DastardStartTime = time.Now()
// Dastard main program will override this, but at least initialize with a sensible value
ProblemLogger = log.New(os.Stderr, "", log.LstdFlags)
UpdateLogger = log.New(os.Stdout, "", log.LstdFlags)
}