@@ -15,13 +15,13 @@ import (
1515const LogFilesToMonitor = "logs.files"
1616
1717type TaskInfo struct {
18- App string
19- Labels map [string ]string
20- TaskID string
21- Hostname string
22- CWD string // Current working directory of the task in the slave
23- FileName string // Actual file name to that we need monitor for logs
24- WorkDir string // WorkDir location of marathon-logger where we setup Symlink
18+ App string
19+ Labels map [string ]string
20+ TaskID string
21+ Hostname string
22+ CWD string // Current working directory of the task in the slave
23+ FileNames [] string // Actual file name to that we need monitor for logs
24+ WorkDir string // WorkDir location of marathon-logger where we setup Symlink
2525}
2626
2727// CleanAppName cleans the app-name string for `/` characters
@@ -54,7 +54,7 @@ func (t *TaskManager) Start() {
5454 t .AddLogs = make (chan TaskInfo )
5555 t .RemoveLogs = make (chan string )
5656 t .KnownTasks = make (map [string ]time.Time )
57- t .Client = & mesos.MesosClient {}
57+ t .Client = mesos .NewMesosClient ()
5858 go t .run ()
5959 fmt .Println ("Task Manager Started." )
6060 fmt .Printf ("Task Manager - Task's MaxHeartBeatInterval is %v\n " , t .MaxTasksHeartBeatInterval )
@@ -101,18 +101,16 @@ func (t *TaskManager) run() {
101101 if executor != nil {
102102 logFiles := strings .Split (maps .GetString (task .Labels , LogFilesToMonitor , "stdout" ), "," )
103103 t .KnownTasks [task .TaskID ] = time .Now ()
104- for _ , file := range logFiles {
105- taskInfo := TaskInfo {
106- App : task .App ,
107- Hostname : task .Hostname ,
108- Labels : task .Labels ,
109- TaskID : task .TaskID ,
110- CWD : executor .Directory ,
111- FileName : file ,
112- }
113- // fmt.Printf("%v\n", taskInfo)
114- t .AddLogs <- taskInfo
104+ taskInfo := TaskInfo {
105+ App : task .App ,
106+ Hostname : task .Hostname ,
107+ Labels : task .Labels ,
108+ TaskID : task .TaskID ,
109+ CWD : executor .Directory ,
110+ FileNames : logFiles ,
115111 }
112+ // fmt.Printf("%v\n", taskInfo)
113+ t .AddLogs <- taskInfo
116114 } else {
117115 log .Printf ("[WARN] Couldn't find the executor that spun up the task %s" , task .TaskID )
118116 }
0 commit comments