func TestAddLogs(t *testing.T) { cl, err := NewClient("http://localhost:9000", "test", "") if err != nil { t.Error(err.Error()) } logs := make([]*commonsLog.Log, 2) now := time.Now() logs[0], err = commonsLog.NewLog(now.UnixNano()/1000000, "DEBUG", "test log1/2 #go", "") if err != nil { t.Error(err.Error()) } now = time.Now() logs[1], err = commonsLog.NewLog(now.UnixNano()/1000000, "DEBUG", "test log2/2 #go", "") if err != nil { t.Error(err.Error()) } err = cl.AddLogs(logs) if err != nil { t.Error(err.Error()) } }
func TestAddLog(t *testing.T) { cl, err := NewClient("http://localhost:9000", "test", "") if err != nil { t.Error(err.Error()) } now := time.Now() log, err := commonsLog.NewLog(now.UnixNano()/1000000, "DEBUG", "test go #go", "") if err != nil { t.Error(err.Error()) } err = cl.AddLog(log) if err != nil { t.Error(err.Error()) } }
func addLog(goTestId string) error { cl, err := NewClient("http://localhost:9000", "test", "") if err != nil { return err } now := time.Now() log, err := commonsLog.NewLog(now.UnixNano()/1000000, "DEBUG", "test go #go #goTestId:"+goTestId, "") if err != nil { return err } err = cl.AddLog(log) if err != nil { return err } return nil }
func addCommandExec() { cl, err := client.NewClient(*addCmd_Url, *addCmd_Application, *addCmd_ApplicationToken) if err != nil { printError("Error: %s", err.Error()) os.Exit(1) } stat, _ := os.Stdin.Stat() stack := "" if (stat.Mode() & os.ModeCharDevice) == 0 { stackBytes, err := ioutil.ReadAll(os.Stdin) if err == nil { stack = string(stackBytes) } } lg, err := commons.NewLog(time.Now().UnixNano()/1000000, *addCmd_Level, *addCmd_Message, stack) if err != nil { printError("Error: %s", err.Error()) os.Exit(1) } cl.AddLog(lg) }