Пример #1
0
func main() {
	logger := cabin.New()
	output := make(chan *cabin.Event)
	logger.Subscribe(output)
	go cabin.StdoutLogger(output)

	conn, err := xgb.Dial(os.Getenv("DISPLAY"))
	if err != nil {
		fmt.Printf("Failed to connect to the X Server (%s)\n", os.Getenv("DISPLAY"))
		os.Exit(1)
	}

	logger.Log("OK")
	logger.Log(conn)
}
Пример #2
0
func main() {
	logger := cabin.New()
	client := new(http.Client)
	response, error := client.Get("http://www.google.com/")
	if error != nil {
		logger.Log(error)
		return
	}

	channel := make(chan *cabin.Event)
	logger.Subscribe(channel)
	go JSONLogger(channel)

	//logger.Log(response)
	//logger.Log("Hello world")
	logger.Log(response.Header)
	//logger.Log(&cabin.Event{Message: "Hello world", Object: response})
}