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

	logger.Log("Hello world")
	logger.Log(42)

	example := Example{Code: 42, Message: "The answer."}
	logger.Log(example)
}
Пример #2
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)
}