Added clean target to Makefile. Created package logger

This commit is contained in:
Héctor Hurtado
2020-04-15 17:52:46 +02:00
parent e1788b2874
commit 63a675675a
2 changed files with 33 additions and 1 deletions
+4 -1
View File
@@ -1,4 +1,4 @@
.PHONY: lint build test jaillover race coverage install acceptance deps docker .PHONY: lint build test jaillover race coverage install acceptance deps docker clean
GOCMD=go GOCMD=go
GOBUILD=$(GOCMD) build -trimpath GOBUILD=$(GOCMD) build -trimpath
@@ -53,3 +53,6 @@ docker: build
cp $(DOCS_DIR)/*.pow $(DOCKER_DIR)/ cp $(DOCS_DIR)/*.pow $(DOCKER_DIR)/
cd $(DOCKER_DIR) && docker build -t kapow . cd $(DOCKER_DIR) && docker build -t kapow .
cd .. cd ..
clean:
rm -rf $(BUILD_DIR) $(OUTPUT_DIR) $(DOCKER_DIR)/*
+29
View File
@@ -0,0 +1,29 @@
package logger
import (
"log"
"os"
)
type LogMsg struct {
prefix,
messages []string
}
var (
loggerChannel = make(chan LogMsg)
execLog = log.New(os.Stdout, "", log.Ldate|log.Ltime|log.LUTC|log.Lmicroseconds)
)
func WriteLog(log LogMsg) {
loggerChannel <- log
}
func ProccessLogs() {
for msg := range loggerChannel {
for _, msgLine := range msg.messages {
execLog.Printf("%s\t%s", msg.prefix, msgLine)
}
}
}