diff --git a/third_party/github.com/ccding/go-logging/README.md b/third_party/github.com/ccding/go-logging/README.md index dbc8187cb..cfcefb603 100644 --- a/third_party/github.com/ccding/go-logging/README.md +++ b/third_party/github.com/ccding/go-logging/README.md @@ -5,14 +5,6 @@ go-logging is a high-performance logging library for golang. low delay of about 800 nano-seconds. ## Getting Started -The stable version is under the `stable` branch, which does never revert and -is fully tested. The tags in `stable` branch indicate the version numbers. - -However, `master` branch is unstable version, and `dev` branch is development -branch. `master` branch merges `dev` branch periodically. - -Btw, all the pull request should be sent to the `dev` branch. - ### Installation The step below will download the library source code to `${GOPATH}/src/github.com/ccding/go-logging`. @@ -46,7 +38,6 @@ import ( func main() { logger, _ := logging.SimpleLogger("main") - logger.SetLevel(logging.DEBUG) logger.Error("this is a test from error") logger.Destroy() } diff --git a/third_party/github.com/ccding/go-logging/example.go b/third_party/github.com/ccding/go-logging/example.go index 5d9fc6397..1b82842fa 100644 --- a/third_party/github.com/ccding/go-logging/example.go +++ b/third_party/github.com/ccding/go-logging/example.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package main import ( diff --git a/third_party/github.com/ccding/go-logging/logging/commands.go b/third_party/github.com/ccding/go-logging/logging/commands.go index 6cf2bb4a3..be1940598 100644 --- a/third_party/github.com/ccding/go-logging/logging/commands.go +++ b/third_party/github.com/ccding/go-logging/logging/commands.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package logging // Logln receives log request from the client. The request includes a set of diff --git a/third_party/github.com/ccding/go-logging/logging/fields.go b/third_party/github.com/ccding/go-logging/logging/fields.go index 74c05b190..aff57fca9 100644 --- a/third_party/github.com/ccding/go-logging/logging/fields.go +++ b/third_party/github.com/ccding/go-logging/logging/fields.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package logging import ( diff --git a/third_party/github.com/ccding/go-logging/logging/fields_test.go b/third_party/github.com/ccding/go-logging/logging/fields_test.go index 8433850d9..7efae3b07 100644 --- a/third_party/github.com/ccding/go-logging/logging/fields_test.go +++ b/third_party/github.com/ccding/go-logging/logging/fields_test.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package logging import ( diff --git a/third_party/github.com/ccding/go-logging/logging/formater.go b/third_party/github.com/ccding/go-logging/logging/formater.go index c704d57ae..8be2a31d2 100644 --- a/third_party/github.com/ccding/go-logging/logging/formater.go +++ b/third_party/github.com/ccding/go-logging/logging/formater.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package logging import ( diff --git a/third_party/github.com/ccding/go-logging/logging/get_go_id.c b/third_party/github.com/ccding/go-logging/logging/get_go_id.c index 400848cf9..f9b216f9f 100644 --- a/third_party/github.com/ccding/go-logging/logging/get_go_id.c +++ b/third_party/github.com/ccding/go-logging/logging/get_go_id.c @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + // This file defines GetGoId function, which is used to get the id of the // current goroutine. More details about this function are availeble in the // runtime.c file of golang source code. diff --git a/third_party/github.com/ccding/go-logging/logging/level.go b/third_party/github.com/ccding/go-logging/logging/level.go index e640fa626..4ada90a03 100644 --- a/third_party/github.com/ccding/go-logging/logging/level.go +++ b/third_party/github.com/ccding/go-logging/logging/level.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package logging // Level is the type of level. diff --git a/third_party/github.com/ccding/go-logging/logging/logging.go b/third_party/github.com/ccding/go-logging/logging/logging.go index 1981c9a61..6467d94ef 100644 --- a/third_party/github.com/ccding/go-logging/logging/logging.go +++ b/third_party/github.com/ccding/go-logging/logging/logging.go @@ -99,13 +99,15 @@ func RichLogger(name string) (*Logger, error) { func FileLogger(name string, level Level, format string, timeFormat string, file string, sync bool) (*Logger, error) { out, err := os.Create(file) if err != nil { - return new(Logger), err + return nil, err } logger, err := createLogger(name, level, format, timeFormat, out, sync) if err == nil { logger.fd = out + return logger, nil + } else { + return nil, err } - return logger, err } // WriterLogger creates a new logger with a writer @@ -115,38 +117,35 @@ func WriterLogger(name string, level Level, format string, timeFormat string, ou // WriterLogger creates a new logger from a configuration file func ConfigLogger(filename string) (*Logger, error) { - conf, err := config.Read(filename) + conf := config.NewConfig(filename) + err := conf.Read() if err != nil { - return new(Logger), err + return nil, err } - ok := true - name, ok := conf["name"] - if !ok { - name = "" - } - slevel, ok := conf["level"] - if !ok { + name := conf.Get("", "name") + slevel := conf.Get("", "level") + if slevel == "" { slevel = "0" } l, err := strconv.Atoi(slevel) if err != nil { - return new(Logger), err + return nil, err } level := Level(l) - format, ok := conf["format"] - if !ok { + format := conf.Get("", "format") + if format == "" { format = BasicFormat } - timeFormat, ok := conf["timeFormat"] - if !ok { + timeFormat := conf.Get("", "timeFormat") + if timeFormat == "" { timeFormat = DefaultTimeFormat } - ssync, ok := conf["sync"] - if !ok { + ssync := conf.Get("", "sync") + if ssync == "" { ssync = "0" } - file, ok := conf["file"] - if !ok { + file := conf.Get("", "file") + if file == "" { file = DefaultFileName } sync := true @@ -155,7 +154,7 @@ func ConfigLogger(filename string) (*Logger, error) { } else if ssync == "1" { sync = true } else { - return new(Logger), err + return nil, err } return FileLogger(name, level, format, timeFormat, file, sync) } @@ -166,7 +165,7 @@ func createLogger(name string, level Level, format string, timeFormat string, ou err := logger.parseFormat(format) if err != nil { - return logger, err + return nil, err } // asign values to logger diff --git a/third_party/github.com/ccding/go-logging/logging/logging_test.go b/third_party/github.com/ccding/go-logging/logging/logging_test.go index b6e0fa502..fcf4bcce6 100644 --- a/third_party/github.com/ccding/go-logging/logging/logging_test.go +++ b/third_party/github.com/ccding/go-logging/logging/logging_test.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package logging import ( diff --git a/third_party/github.com/ccding/go-logging/logging/request.go b/third_party/github.com/ccding/go-logging/logging/request.go index e823fa719..4b8641083 100644 --- a/third_party/github.com/ccding/go-logging/logging/request.go +++ b/third_party/github.com/ccding/go-logging/logging/request.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package logging // request struct stores the logger request diff --git a/third_party/github.com/ccding/go-logging/logging/writer.go b/third_party/github.com/ccding/go-logging/logging/writer.go index 12d17901a..9efeddf60 100644 --- a/third_party/github.com/ccding/go-logging/logging/writer.go +++ b/third_party/github.com/ccding/go-logging/logging/writer.go @@ -13,7 +13,7 @@ // limitations under the License. // // author: Cong Ding -// + package logging import (