예제 #1
0
func TestLoadConfig(t *testing.T) {

	withTempConfigFile(t, func(filename string) {
		actual, err := config.LoadConfig(filename)
		if err != nil {
			t.Error(err.Error())
			return
		}

		inputs := []string{"file:///var/log/nginx/access.log", "file:///var/log/nginx/error.log"}
		expected := &config.Config{Inputs: inputs}

		if !reflect.DeepEqual(expected, actual) {
			t.Errorf("got %v\nwant %v", expected, actual)
			return
		}
	})
}
예제 #2
0
파일: main.go 프로젝트: jksy/go-log-viewer
func main() {
	conf, err := config.LoadConfig("config.json")
	if err != nil {
		panic("load config error:" + err.Error())
	}

	readCh := make(chan []byte, 200)
	prepareReader(conf, readCh)
	broadcaster = prepareWriter(readCh)

	setupWebsocketUrl("/log/", broadcaster)
	setupIndexPage()

	err = http.ListenAndServe(":8080", nil)
	if err != nil {
		panic("ListenAndServe: " + err.Error())
	}
}