-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
41 lines (34 loc) · 880 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* Author: Juntaran
* Email: Jacinthmail@gmail.com
* Date: 2018/11/23 19:16
*/
package main
import (
"github.com/Juntaran/EZLogCollector/harvester/lcFile"
"github.com/Juntaran/EZLogCollector/prospector"
"log"
"os"
)
func buildStates(path string) (lcFile.States, error) {
fileinfo, err := os.Stat(path)
if err != nil {
log.Println(err)
return *lcFile.NewStates(), err
}
state := lcFile.NewState(fileinfo, path)
states := lcFile.NewStates()
states.SetStates([]lcFile.State{state})
return *states, nil
}
func main() {
states, err := buildStates("/Users/juntaran/Workspace/goWorkspace/src/github.com/Juntaran/EZLogCollector/tests/files/logs/json.log")
if err != nil {
log.Println(err)
}
prospector, err := prospector.NewProspector(states, nil)
if err != nil {
log.Printf("Error in initing prospector: %s\n", err)
}
prospector.Run()
}