forked from rethinkdb/rethinkdb-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gorethink.go
58 lines (47 loc) · 1.48 KB
/
gorethink.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
package gorethink
import (
"io/ioutil"
"reflect"
"github.com/Sirupsen/logrus"
"gopkg.in/gorethink/gorethink.v3/encoding"
)
var (
Log *logrus.Logger
)
const (
SystemDatabase = "rethinkdb"
TableConfigSystemTable = "table_config"
ServerConfigSystemTable = "server_config"
DBConfigSystemTable = "db_config"
ClusterConfigSystemTable = "cluster_config"
TableStatusSystemTable = "table_status"
ServerStatusSystemTable = "server_status"
CurrentIssuesSystemTable = "current_issues"
UsersSystemTable = "users"
PermissionsSystemTable = "permissions"
JobsSystemTable = "jobs"
StatsSystemTable = "stats"
LogsSystemTable = "logs"
)
func init() {
// Set encoding package
encoding.IgnoreType(reflect.TypeOf(Term{}))
Log = logrus.New()
Log.Out = ioutil.Discard // By default don't log anything
}
// SetVerbose allows the driver logging level to be set. If true is passed then
// the log level is set to Debug otherwise it defaults to Info.
func SetVerbose(verbose bool) {
if verbose {
Log.Level = logrus.DebugLevel
return
}
Log.Level = logrus.InfoLevel
}
// SetTags allows you to override the tags used when decoding or encoding
// structs. The driver will check for the tags in the same order that they were
// passed into this function. If no parameters are passed then the driver will
// default to checking for the gorethink tag (the gorethink tag is always included)
func SetTags(tags ...string) {
encoding.Tags = append(tags, "gorethink")
}