blob: ce5dd1b8e95981db7d0051ba9d5f6bdaf463ecc9 [file] [log] [blame]
// Copyright 2019 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// The maintwatch commands tails the maintner mutation log.
package main
import (
var server = flag.String("server", godata.Server, "maintner server's /logs URL")
func main() {
tm := proto.TextMarshaler{Compact: false}
for {
err := maintner.TailNetworkMutationSource(context.Background(), *server, func(e maintner.MutationStreamEvent) error {
if e.Err != nil {
log.Printf("# ignoring err: %v\n", e.Err)
time.Sleep(5 * time.Second)
return nil
tm.Marshal(os.Stdout, e.Mutation)
return nil
log.Printf("tail error: %v; restarting\n", err)