gopkg.in/rethinkdb/rethinkdb-go.v6@v6.2.2/rethinkdb.go (about) 1 package rethinkdb 2 3 import ( 4 "reflect" 5 6 "github.com/sirupsen/logrus" 7 8 "gopkg.in/rethinkdb/rethinkdb-go.v6/encoding" 9 "io/ioutil" 10 ) 11 12 var ( 13 // Log is logger for debug purpuses. 14 // deprecated 15 Log *logrus.Logger 16 ) 17 18 const ( 19 SystemDatabase = "rethinkdb" 20 21 TableConfigSystemTable = "table_config" 22 ServerConfigSystemTable = "server_config" 23 DBConfigSystemTable = "db_config" 24 ClusterConfigSystemTable = "cluster_config" 25 TableStatusSystemTable = "table_status" 26 ServerStatusSystemTable = "server_status" 27 CurrentIssuesSystemTable = "current_issues" 28 UsersSystemTable = "users" 29 PermissionsSystemTable = "permissions" 30 JobsSystemTable = "jobs" 31 StatsSystemTable = "stats" 32 LogsSystemTable = "logs" 33 ) 34 35 func init() { 36 // Set encoding package 37 encoding.IgnoreType(reflect.TypeOf(Term{})) 38 39 Log = logrus.New() 40 Log.Out = ioutil.Discard // By default don't log anything 41 } 42 43 // SetVerbose allows the driver logging level to be set. If true is passed then 44 // the log level is set to Debug otherwise it defaults to Info. 45 func SetVerbose(verbose bool) { 46 if verbose { 47 Log.Level = logrus.DebugLevel 48 return 49 } 50 51 Log.Level = logrus.InfoLevel 52 } 53 54 // SetTags allows you to override the tags used when decoding or encoding 55 // structs. The driver will check for the tags in the same order that they were 56 // passed into this function. If no parameters are passed then the driver will 57 // default to checking for the rethinkdb tag (the rethinkdb tag is always included) 58 // Old-style gorethink tag is also supported but deprecated 59 func SetTags(tags ...string) { 60 encoding.Tags = append(tags, encoding.TagName, encoding.OldTagName) 61 }