v 1.0.0 - Added functionnal testing - Needs Travis integration

This commit is contained in:
Brendan LE GLAUNEC
2016-06-21 10:53:24 +02:00
parent 08231074b9
commit 1f5e9fc502
24 changed files with 1138 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
package main
import (
"bufio"
"fmt"
"io"
)
// Launch it via goroutine
// Start read log of service
func readLog(service *Service, reader io.ReadCloser) {
scanner := bufio.NewScanner(reader)
for scanner.Scan() {
str := scanner.Text()
if service.Console {
fmt.Printf("[%s] %s\n", service.Path, str)
}
fmt.Printf("%s\n", str)
service.Mutex.Lock()
service.Logs = append(service.Logs, str)
service.Mutex.Unlock()
}
if err := scanner.Err(); err != nil {
fmt.Printf("[%s] Service failed: %s\n", service.Path, err)
}
fmt.Printf("Logger of service: [%s] stopped\n", service.Path)
service.Active = false
}