aboutsummaryrefslogtreecommitdiffstats
path: root/ethutil/config.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-17 00:25:24 +0800
committerobscuren <geffobscura@gmail.com>2014-06-17 00:25:24 +0800
commit5a0e75173626704c3d58be582dff318218569ef3 (patch)
tree801ec6d33fe21e46230a3082cd069534f64aa251 /ethutil/config.go
parent006ac772e6c81271a84ff56e00527b2adbc0129c (diff)
parentff0f15f7634ca713b0ce8232a8fa63eec5c3fad7 (diff)
downloaddexon-5a0e75173626704c3d58be582dff318218569ef3.tar
dexon-5a0e75173626704c3d58be582dff318218569ef3.tar.gz
dexon-5a0e75173626704c3d58be582dff318218569ef3.tar.bz2
dexon-5a0e75173626704c3d58be582dff318218569ef3.tar.lz
dexon-5a0e75173626704c3d58be582dff318218569ef3.tar.xz
dexon-5a0e75173626704c3d58be582dff318218569ef3.tar.zst
dexon-5a0e75173626704c3d58be582dff318218569ef3.zip
Merge branch 'release/0.5.13'
Diffstat (limited to 'ethutil/config.go')
-rw-r--r--ethutil/config.go39
1 files changed, 31 insertions, 8 deletions
diff --git a/ethutil/config.go b/ethutil/config.go
index e992bda12..a24c39bfe 100644
--- a/ethutil/config.go
+++ b/ethutil/config.go
@@ -75,11 +75,11 @@ func ReadConfig(base string, logTypes LoggerType, g *globalconf.GlobalConf, id s
if Config == nil {
path := ApplicationFolder(base)
- Config = &config{ExecPath: path, Debug: true, Ver: "0.5.0 RC12"}
+ Config = &config{ExecPath: path, Debug: true, Ver: "0.5.13"}
Config.conf = g
Config.Identifier = id
Config.Log = NewLogger(logTypes, LogLevelDebug)
- Config.SetClientString("/Ethereum(G)")
+ Config.SetClientString("Ethereum(G)")
}
return Config
@@ -88,11 +88,9 @@ func ReadConfig(base string, logTypes LoggerType, g *globalconf.GlobalConf, id s
// Set client string
//
func (c *config) SetClientString(str string) {
- id := runtime.GOOS
- if len(c.Identifier) > 0 {
- id = c.Identifier
- }
- Config.ClientString = fmt.Sprintf("%s nv%s/%s", str, c.Ver, id)
+ os := runtime.GOOS
+ cust := c.Identifier
+ Config.ClientString = fmt.Sprintf("%s/v%s/%s/%s/Go", str, c.Ver, cust, os)
}
func (c *config) SetIdentifier(id string) {
@@ -145,12 +143,17 @@ func NewLogger(flag LoggerType, level int) *Logger {
return &Logger{logSys: loggers, logLevel: level}
}
+func (self *Logger) SetLevel(level int) {
+ self.logLevel = level
+}
+
func (log *Logger) AddLogSystem(logger LogSystem) {
log.logSys = append(log.logSys, logger)
}
const (
- LogLevelDebug = iota
+ LogLevelSystem = iota
+ LogLevelDebug
LogLevelInfo
)
@@ -206,6 +209,26 @@ func (log *Logger) Fatal(v ...interface{}) {
os.Exit(1)
}
+func (log *Logger) Println(level int, v ...interface{}) {
+ if log.logLevel > level {
+ return
+ }
+
+ for _, logger := range log.logSys {
+ logger.Println(v...)
+ }
+}
+
+func (log *Logger) Printf(level int, format string, v ...interface{}) {
+ if log.logLevel > level {
+ return
+ }
+
+ for _, logger := range log.logSys {
+ logger.Printf(format, v...)
+ }
+}
+
type confValue struct {
value string
}