Implementing the new logging infrastructure

Moved logging to the new logging infrastructure by removing the use of
ColorLog() function. Added more documentation. Also fixed some typos in
comments and function names.
This commit is contained in:
Faissal Elamraoui
2016-11-13 15:14:48 +01:00
parent 0e54238559
commit cf7aef47f0
26 changed files with 421 additions and 525 deletions

26
test.go
View File

@ -51,19 +51,19 @@ var started = make(chan bool)
func testApp(cmd *Command, args []string) int {
if len(args) != 1 {
ColorLog("[ERRO] Cannot start running[ %s ]\n",
"argument 'appname' is missing")
os.Exit(2)
logger.Fatalf("Failed to start: %s", "argument 'appname' is missing")
}
crupath, _ := os.Getwd()
Debugf("current path:%s\n", crupath)
currpath, _ := os.Getwd()
logger.Debugf("Current path: %s", currpath)
err := loadConfig()
if err != nil {
ColorLog("[ERRO] Fail to parse bee.json[ %s ]\n", err)
logger.Fatalf("Failed to load configuration: %s", err)
}
var paths []string
readAppDirectories(crupath, &paths)
readAppDirectories(currpath, &paths)
NewWatcher(paths, nil, false)
appname = args[0]
@ -76,7 +76,7 @@ func testApp(cmd *Command, args []string) int {
}
func runTest() {
ColorLog("[INFO] Start testing...\n")
logger.Info("Start testing...")
time.Sleep(time.Second * 1)
crupwd, _ := os.Getwd()
testDir := path.Join(crupwd, "tests")
@ -88,14 +88,14 @@ func runTest() {
icmd := exec.Command("go", "test")
icmd.Stdout = os.Stdout
icmd.Stderr = os.Stderr
ColorLog("[TRAC] ============== Test Begin ===================\n")
logger.Info("============== Test Begin ===================")
err = icmd.Run()
ColorLog("[TRAC] ============== Test End ===================\n")
logger.Info("============== Test End =====================")
if err != nil {
ColorLog("[ERRO] ============== Test failed ===================\n")
ColorLog("[ERRO] %s", err)
logger.Error("============== Test failed ===================")
logger.Errorf("Cause: %s", err)
return
}
ColorLog("[SUCC] Test finish\n")
logger.Success("Test Completed")
}