コード例 #1
0
ファイル: mysql-sniffer.go プロジェクト: jayed/mysql-sniffer
func handleStatusUpdate(displaycount int) {
	elapsed := float64(UnixNow() - start)

	// print status bar
	log.Printf("\n")
	log.SetFlags(log.Ldate | log.Ltime)
	log.Printf("%d total queries, %0.2f per second", querycount, float64(querycount)/elapsed)
	log.SetFlags(0)

	// we cheat so badly here...
	var tmp sort.StringSlice = make([]string, 0, len(qbuf))
	for q, c := range qbuf {
		tmp = append(tmp, fmt.Sprintf("%6d  %0.2f/s  %s", c, float64(c)/elapsed, q))
	}
	sort.Sort(tmp)

	// now print top to bottom, since our sorted list is sorted backwards
	// from what we want
	if len(tmp) < displaycount {
		displaycount = len(tmp)
	}
	for i := 1; i <= displaycount; i++ {
		log.Printf(tmp[len(tmp)-i])
	}
}
コード例 #2
0
ファイル: nats-rply.go プロジェクト: aminjam/mq-resource
func main() {
	var urls = flag.String("s", nats.DefaultURL, "The nats server URLs (separated by comma)")
	var showTime = flag.Bool("t", false, "Display timestamps")

	log.SetFlags(0)
	flag.Usage = usage
	flag.Parse()

	args := flag.Args()
	if len(args) < 2 {
		usage()
	}

	nc, err := nats.Connect(*urls)
	if err != nil {
		log.Fatalf("Can't connect: %v\n", err)
	}

	subj, reply, i := args[0], args[1], 0

	nc.Subscribe(subj, func(msg *nats.Msg) {
		i++
		printMsg(msg, i)
		nc.Publish(msg.Reply, []byte(reply))
	})

	log.Printf("Listening on [%s]\n", subj)
	if *showTime {
		log.SetFlags(log.LstdFlags)
	}

	runtime.Goexit()
}
コード例 #3
0
func handleStatusUpdate(displaycount int, sortby string, cutoff int) {
	elapsed := float64(UnixNow() - start)

	// print status bar
	log.Printf("\n")
	log.SetFlags(log.Ldate | log.Ltime)
	log.Printf("%s%d total queries, %0.2f per second%s", COLOR_RED, querycount,
		float64(querycount)/elapsed, COLOR_DEFAULT)
	log.SetFlags(0)

	log.Printf("%d packets (%0.2f%% on synchronized streams) / %d desyncs / %d streams",
		stats.packets.rcvd, float64(stats.packets.rcvd_sync)/float64(stats.packets.rcvd)*100,
		stats.desyncs, stats.streams)

	// global timing values
	gmin, gavg, gmax := calculateTimes(&times)
	log.Printf("%0.2fms min / %0.2fms avg / %0.2fms max query times", gmin, gavg, gmax)
	log.Printf("%d unique results in this filter", len(qbuf))
	log.Printf(" ")
	log.Printf("%s count     %sqps     %s  min    avg   max      %sbytes      per qry%s",
		COLOR_YELLOW, COLOR_CYAN, COLOR_YELLOW, COLOR_GREEN, COLOR_DEFAULT)

	// we cheat so badly here...
	var tmp sortableSlice = make(sortableSlice, 0, len(qbuf))
	for q, c := range qbuf {
		qps := float64(c.count) / elapsed
		if qps < float64(cutoff) {
			continue
		}

		qmin, qavg, qmax := calculateTimes(&c.times)
		bavg := uint64(float64(c.bytes) / float64(c.count))

		sorted := float64(c.count)
		if sortby == "avg" {
			sorted = qavg
		} else if sortby == "max" {
			sorted = qmax
		} else if sortby == "maxbytes" {
			sorted = float64(c.bytes)
		} else if sortby == "avgbytes" {
			sorted = float64(bavg)
		}

		tmp = append(tmp, sortable{sorted, fmt.Sprintf(
			"%s%6d  %s%7.2f/s  %s%6.2f %6.2f %6.2f  %s%9db %6db %s%s%s",
			COLOR_YELLOW, c.count, COLOR_CYAN, qps, COLOR_YELLOW, qmin, qavg, qmax,
			COLOR_GREEN, c.bytes, bavg, COLOR_WHITE, q, COLOR_DEFAULT)})
	}
	sort.Sort(tmp)

	// now print top to bottom, since our sorted list is sorted backwards
	// from what we want
	if len(tmp) < displaycount {
		displaycount = len(tmp)
	}
	for i := 1; i <= displaycount; i++ {
		log.Printf(tmp[len(tmp)-i].line)
	}
}
コード例 #4
0
ファイル: log.go プロジェクト: ibmendoza/dgtk
func init() {
	if os.Getenv("DEBUG") == "true" {
		log.SetFlags(log.Llongfile)
	} else {
		log.SetFlags(0)
	}
}
コード例 #5
0
ファイル: main.go プロジェクト: carriercomm/docker-hive
func main() {
	log.SetFlags(0)
	flag.Parse()
	if version {
		fmt.Println(VERSION)
		os.Exit(0)
	}

	rand.Seed(time.Now().UnixNano())
	log.SetFlags(log.LstdFlags)
	log.Printf("Docker Hive %s\n", VERSION)

	// connect to redis
	pool := utils.NewRedisPool(redisHost, redisPort, redisPass)
	// set node name
	if nodeName == "" {
		name, err := os.Hostname()
		if err != nil {
			log.Printf("Error getting hostname: %s", err)
			nodeName = "localhost"
		}
		nodeName = name
	}
	// start node
	engine := hive.NewEngine(host, port, dockerPath, VERSION, nodeName, zone, pool, runPolicy)

	waiter, err := engine.Start()
	if err != nil {
		log.Fatal(err)
		return
	}
	waiter.Wait()
}
コード例 #6
0
func main() {
	var urls = flag.String("nats", nats.DefaultURL, "The nats server URLs (separated by comma)")
	var mgoDB = flag.String("db", "localhost:27017", "Mongo databast URL")
	var showTime = flag.Bool("t", false, "Display timestamps")

	log.SetFlags(0)
	flag.Usage = usage
	flag.Parse()

	args := flag.Args()
	if len(args) < 1 {
		usage()
		fmt.Println("mgoDB", mgoDB)
	}

	opts := nats.DefaultOptions
	opts.Servers = strings.Split(*urls, ",")
	for i, s := range opts.Servers {
		opts.Servers[i] = strings.Trim(s, " ")
	}

	nc, err := opts.Connect()
	if err != nil {
		log.Fatalf("Can't connect: %v\n", err)
	}

	subj, i := args[0], 0

	nc.Subscribe(subj, func(msg *nats.Msg) {
		// ok we need to write this to a mgo database and assume that it's mostly valid ;)
		// we will use the last part of the subj as the collection and the first part as the db.
		// First we convert the Msg into a json obj.
		// then we dump the json into Bson and into mongo.

		var jsonObj map[string]interface{}

		err := json.Unmarshal([]byte(msg.Data), &jsonObj)
		if err != nil {
			// Bad json.
			log.Fatalf("Bad json passed: (%s)\n", msg.Data)
		}

		// ok let's split the msg subject and use part 1 for db and part 2 for collection. throwing away the rest
		foo := strings.Split(subj, ".")

		// Create mgo session
		session, err := mgo.Dial(*mgoDB)
		c := session.Copy().DB(foo[0]).C(foo[1]) // Add the mongo db stuff
		c.Insert(jsonObj)

		printMsg(msg, i)
	})

	log.Printf("Listening on [%s]\n", subj)
	if *showTime {
		log.SetFlags(log.LstdFlags)
	}

	runtime.Goexit()
}
コード例 #7
0
ファイル: main.go プロジェクト: jmptrader/copy-bench
func main() {
	log.SetFlags(0)
	flag.Parse()
	path := flag.Arg(0)
	if path == "" {
		log.Fatal("usage: copy-bench PATH")
	}

	log.SetFlags(log.LstdFlags | log.Lmicroseconds)
	runtime.GOMAXPROCS(2)

	// Check if this is a new data file.
	_, err := os.Stat(path)
	isNew := os.IsNotExist(err)

	// Open database.
	db, err := bolt.Open(path, 0600)
	if err != nil {
		log.Fatal(err)
	}

	// Populate the initial database.
	if isNew {
		if err := seed(db); err != nil {
			log.Fatal(err)
		}
	}

	// Print stats of the db.
	if err := stat(db); err != nil {
		log.Fatal(err)
	}

	// Iterate once to push pages into memory.
	c := make(chan bool)
	fmt.Println("first run (ignore)")
	go func() { iterate(db, c) }()
	c <- true
	fmt.Println("")

	// Time iteration without copy.
	fmt.Println("iterate only")
	go iterate(db, c)
	time.Sleep(2 * time.Second)
	c <- true
	fmt.Println("")

	// Start iterator thread.
	fmt.Println("iterate during copy")
	go iterate(db, c)

	// Begin copy of the database.
	if err := dbcopy(db); err != nil {
		log.Fatal(err)
	}

	// Notify iterator of db copy completion.
	c <- true
	time.Sleep(100 * time.Millisecond)
}
コード例 #8
0
ファイル: main.go プロジェクト: schollz/boltd
func main() {
	log.SetFlags(0)
	var (
		addr = flag.String("addr", ":9000", "bind address")
	)
	flag.Parse()

	// Validate parameters.
	var path = flag.Arg(0)
	if path == "" {
		log.Fatal("path required")
	}

	// Open the database.
	db, err := bolt.Open(path, 0600, nil)
	if err != nil {
		log.Fatal(err)
	}

	// Enable logging.
	log.SetFlags(log.LstdFlags)

	// Setup the HTTP handlers.
	http.Handle("/", boltd.NewHandler(db))

	// Start the HTTP server.
	go func() { log.Fatal(http.ListenAndServe(*addr, nil)) }()

	fmt.Printf("Listening on http://localhost%s\n", *addr)
	select {}
}
コード例 #9
0
ファイル: main.go プロジェクト: raff/raftd
func main() {
	log.SetFlags(0)
	flag.Parse()
	if verbose {
		log.Print("Verbose logging enabled.")
	}
	if trace {
		raft.SetLogLevel(raft.Trace)
		log.Print("Raft trace debugging enabled.")
	} else if debug {
		raft.SetLogLevel(raft.Debug)
		log.Print("Raft debugging enabled.")
	}

	rand.Seed(time.Now().UnixNano())

	// Setup commands.
	raft.RegisterCommand(&command.WriteCommand{})

	// Set the data directory.
	if flag.NArg() == 0 {
		log.Fatal("Data path argument required")
	}
	path := flag.Arg(0)
	if err := os.MkdirAll(path, 0744); err != nil {
		log.Fatalf("Unable to create path: %v", err)
	}

	log.SetFlags(log.LstdFlags)
	s := server.New(path, host, port)
	log.Fatal(s.ListenAndServe(join))
}
コード例 #10
0
ファイル: logging.go プロジェクト: strukturag/phoenix
func setSystemLogger(name string, w io.Writer) {
	log.SetOutput(w)
	if name != "" {
		log.SetPrefix(name + " ")
		log.SetFlags(log.LstdFlags)
	} else {
		log.SetFlags(log.LstdFlags &^ (log.Ldate | log.Ltime))
	}
}
コード例 #11
0
ファイル: errors.go プロジェクト: dmexe/log-shuttle
func WarnErr(err error, msg ...interface{}) error {
	if err != nil {
		f := log.Flags()
		log.SetFlags(0)
		log.Println(makeErr(err, msg...))
		log.SetFlags(f)
	}
	return err
}
コード例 #12
0
ファイル: log.go プロジェクト: sknop/direnv
func logMsg(format, msg string, a ...interface{}) {
	defer log.SetFlags(log.Flags())
	defer log.SetPrefix(log.Prefix())
	log.SetFlags(0)
	log.SetPrefix("")

	msg = fmt.Sprintf(format+"\n", msg)
	log.Printf(msg, a...)
}
コード例 #13
0
ファイル: log.go プロジェクト: sknop/direnv
func setupLogging(env Env) {
	log.SetFlags(0)
	log.SetPrefix("")
	if val, ok := env[DIRENV_DEBUG]; ok == true && val == "1" {
		debugging = true
		log.SetFlags(log.Ltime)
		log.SetPrefix("direnv: ")
	}
}
コード例 #14
0
ファイル: log.go プロジェクト: sknop/direnv
func log_debug(msg string, a ...interface{}) {
	if !debugging {
		return
	}
	defer log.SetFlags(log.Flags())
	log.SetFlags(log.Flags() | log.Lshortfile)
	msg = fmt.Sprintf(msg, a...)
	log.Output(2, msg)
}
コード例 #15
0
ファイル: debug.go プロジェクト: Anaminus/rbxplore
func InitDebug() {
	if Option.Debug {
		log.SetFlags(log.Ltime)
		log.SetOutput(os.Stdout)
	} else {
		log.SetFlags(0)
		log.SetOutput(ioutil.Discard)
	}
}
コード例 #16
0
func captureLog(f func()) string {
	buf := new(bytes.Buffer)
	prevFlags := log.Flags()
	log.SetFlags(0)
	log.SetOutput(buf)
	f()
	log.SetFlags(prevFlags)
	log.SetOutput(ioutil.Discard)
	return buf.String()
}
コード例 #17
0
ファイル: logger.go プロジェクト: TimothyYe/godns
//flush buf data to std log
func (this *Logger) Flush() {
	if this.buf.Len() > 0 {
		this.mu.Lock()
		defer this.mu.Unlock()

		log.SetFlags(0)
		log.Print(this.buf)
		log.SetFlags(log.LstdFlags)
		this.buf.Reset()
	}
}
コード例 #18
0
ファイル: logging.go プロジェクト: couchbaselabs/cbgb
func initLogger(slog bool) {
	if slog {
		lw, err := syslog.New(syslog.LOG_INFO, "cbgb")
		must(err)
		log.SetOutput(lw)
		log.SetFlags(0)
	}
	if *logPlain {
		log.SetFlags(0)
	}
}
コード例 #19
0
ファイル: main.go プロジェクト: kimitoboku/RecResolve
func main() {
	app := cli.NewApp()
	app.Usage = "It is a tool to see Iterative Search of the DNS is how to."
	app.Version = Version

	app.Commands = []cli.Command{
		{
			Name:    "rec",
			Aliases: []string{"r"},
			Usage:   "Iterative Search",
			Action: func(c *cli.Context) {
				if debug {
					log.SetFlags(log.Llongfile)
				}
				recRsolve(c.Args().First(), root, 0)
			},
		},
		{
			Name:    "norec",
			Aliases: []string{"n"},
			Usage:   "No Iterative Search",
			Action: func(c *cli.Context) {
				if debug {
					log.SetFlags(log.Llongfile)
				}
				noRecRsolve(c.Args().First(), root)
			},
		},
	}

	app.Flags = []cli.Flag{
		cli.StringFlag{
			Name:        "root",
			Value:       "202.12.27.33",
			Usage:       "Root DNS Server's IP address",
			Destination: &root,
		},
		cli.BoolFlag{
			Name:        "debug",
			Usage:       "Debug Option for Developer",
			EnvVar:      "false",
			Destination: &debug,
		},
		cli.BoolFlag{
			Name:        "fool",
			Usage:       "Believe something like flue record",
			EnvVar:      "false",
			Destination: &fool,
		},
	}
	if err := app.Run(os.Args); err != nil {
		fmt.Println(err)
	}
}
コード例 #20
0
ファイル: main.go プロジェクト: rayleyva/skybox
func main() {
	log.SetFlags(0)

	// Read configuration.
	flag.Usage = usage
	flag.Parse()

	// Validate arguments.
	if *dataDir == "" {
		log.Fatal("data directory required: --data-dir")
	} else if *certFile != "" && *keyFile == "" {
		log.Fatal("key file required: --key-file")
	} else if *keyFile != "" && *certFile == "" {
		log.Fatal("certificate file required: --cert-file")
	}
	var useTLS = (*certFile != "" && *keyFile != "")

	// Initialize data directory.
	if err := os.MkdirAll(*dataDir, 0700); err != nil {
		log.Fatal(err)
	}

	// Seed the PRNG for API key generation.
	rand.Seed(time.Now().Unix())

	// Initialize db.
	var db db.DB
	if err := db.Open(filepath.Join(*dataDir, "db"), 0666); err != nil {
		log.Fatal(err)
	}
	defer db.Close()

	// Initialize handler.
	h, err := server.NewHandler(&db)
	if err != nil {
		log.Fatal(err)
	}
	logHandler := handlers.CombinedLoggingHandler(os.Stdout, h)

	// Start servers.
	log.Printf("Listening on http://localhost%s", *addr)
	if useTLS {
		log.Printf("Listening on http://localhost%s", *tlsAddr)
	}
	log.SetFlags(log.LstdFlags)

	go func() { log.Fatal(http.ListenAndServe(*addr, logHandler)) }()
	if useTLS {
		go func() { log.Fatal(http.ListenAndServeTLS(*tlsAddr, *certFile, *keyFile, logHandler)) }()
	}

	select {}
}
コード例 #21
0
ファイル: logging_test.go プロジェクト: smartystreets/logging
func TestLoggingWithNilReferenceProducesTraditionalBehavior(t *testing.T) {
	out := new(bytes.Buffer)
	log.SetOutput(out)
	log.SetFlags(0)
	defer log.SetOutput(os.Stdout)
	defer log.SetFlags(log.LstdFlags)

	thing := new(ThingUnderTest)
	thing.Action()

	assertions.New(t).So(out.String(), should.Equal, "Hello, World!\n")
}
コード例 #22
0
ファイル: logging.go プロジェクト: steveyen/cbgb
func initLogger(slog bool) {
	if slog {
		lw, err := syslog.New(syslog.LOG_INFO, "cbgb")
		if err != nil {
			log.Fatalf("Can't initialize syslog: %v", err)
		}
		log.SetOutput(lw)
		log.SetFlags(0)
	}
	if *logPlain {
		log.SetFlags(0)
	}
}
コード例 #23
0
ファイル: config.go プロジェクト: shashikiranrp/caddy
// Load reads input (named filename) and parses it, returning server
// configurations grouped by listening address.
func Load(filename string, input io.Reader) (Group, error) {
	var configs []server.Config

	// turn off timestamp for parsing
	flags := log.Flags()
	log.SetFlags(0)

	serverBlocks, err := parse.ServerBlocks(filename, input)
	if err != nil {
		return nil, err
	}
	if len(serverBlocks) == 0 {
		return Default()
	}

	// Each server block represents one or more servers/addresses.
	// Iterate each server block and make a config for each one,
	// executing the directives that were parsed.
	for _, sb := range serverBlocks {
		sharedConfig, err := serverBlockToConfig(filename, sb)
		if err != nil {
			return nil, err
		}

		// Now share the config with as many hosts as share the server block
		for i, addr := range sb.Addresses {
			config := sharedConfig
			config.Host = addr.Host
			config.Port = addr.Port
			if config.Port == "" {
				config.Port = Port
			}
			if config.Port == "http" {
				config.TLS.Enabled = false
				log.Printf("Warning: TLS disabled for %s://%s. To force TLS over the plaintext HTTP port, "+
					"specify port 80 explicitly (https://%s:80).", config.Port, config.Host, config.Host)
			}
			if i == 0 {
				sharedConfig.Startup = []func() error{}
				sharedConfig.Shutdown = []func() error{}
			}
			configs = append(configs, config)
		}
	}

	// restore logging settings
	log.SetFlags(flags)

	// Group by address/virtualhosts
	return arrangeBindings(configs)
}
コード例 #24
0
ファイル: raftX.go プロジェクト: izouxv/raftX
func main() {
	go func() {
		//http://localhost:6060/debug/pprof/
		log.Println(http.ListenAndServe("localhost:6060", nil))
	}()

	log.SetFlags(0)
	flag.Parse()
	if verbose {
		log.Print("Verbose logging enabled.")
	}
	if trace {
		raft.SetLogLevel(raft.Trace)
		log.Print("Raft trace debugging enabled.")
	} else if debug {
		raft.SetLogLevel(raft.Debug)
		log.Print("Raft debugging enabled.")
	}

	rand.Seed(time.Now().UnixNano())

	// Setup commands.
	raft.RegisterCommand(&command.SetCommand{})
	raft.RegisterCommand(&command.RemoveTmpDataCommand{})

	// Set the data directory.
	if flag.NArg() == 0 {
		flag.Usage()
		log.Fatal("Data path argument required")
	}
	path := flag.Arg(0)
	if err := os.MkdirAll(path, 0744); err != nil {
		log.Fatalf("Unable to create path: %v", err)
	}

	//	log.Fatalf("join: %v", join)
	//	log.Fatalf(" path: %v", path)

	log.SetFlags(log.LstdFlags)
	s := server.New(path, host, port)

	if true {
		runtime.GOMAXPROCS(runtime.NumCPU())
	}
	addr := fmt.Sprintf("%s:%d", host, tcpSerPort)

	//log.Fatal(s.ListenAndServe(join, addr))
	s.ListenAndServe(join, addr)
	select {}
}
コード例 #25
0
ファイル: main.go プロジェクト: rails0330/log
func main() {
	log.Println("hello")

	// You can see flags define in http://golang.org/pkg/log/#pkg-constants
	log.SetFlags(log.Ldate | log.Ltime | log.Lmicroseconds | log.Lshortfile)
	log.Println("hello")

	// default format
	log.SetFlags(log.LstdFlags)

	// set prefix string
	log.SetPrefix("server1 ")
	log.Println("hello")
}
コード例 #26
0
ファイル: logging_test.go プロジェクト: smartystreets/logging
func TestLoggingWithLoggerCapturesOutput(t *testing.T) {
	out := new(bytes.Buffer)
	log.SetOutput(out)
	log.SetFlags(0)
	defer log.SetOutput(os.Stdout)
	defer log.SetFlags(log.LstdFlags)

	thing := new(ThingUnderTest)
	thing.log = Capture()
	thing.Action()

	assertions.New(t).So(thing.log.Log.String(), should.Equal, "Hello, World!\n")
	assertions.New(t).So(out.Len(), should.Equal, 0)
}
コード例 #27
0
ファイル: logging_test.go プロジェクト: smartystreets/logging
func TestLoggingWithDiscard(t *testing.T) {
	out := new(bytes.Buffer)
	log.SetOutput(out)
	log.SetFlags(0)
	defer log.SetOutput(os.Stdout)
	defer log.SetFlags(log.LstdFlags)

	thing := new(ThingUnderTest)
	thing.log = Discard()
	thing.Action()

	assertions.New(t).So(thing.log.Log.Len(), should.Equal, 0)
	assertions.New(t).So(out.Len(), should.Equal, 0)
}
コード例 #28
0
ファイル: harp.go プロジェクト: jmptrader/harp
func init() {
	if debugf {
		log.SetFlags(log.Lshortfile)
	} else {
		log.SetFlags(0)
	}

	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	go func() {
		for range c {
			cleanCaches()
		}
	}()
}
コード例 #29
0
func init() {
	hooks = hook.Hooks{}

	flag.Parse()

	log.SetPrefix("[webhook] ")
	log.SetFlags(log.Ldate | log.Ltime)

	if !*verbose {
		log.SetOutput(ioutil.Discard)
	}

	log.Println("version " + version + " starting")

	// load and parse hooks
	log.Printf("attempting to load hooks from %s\n", *hooksFilePath)

	err := hooks.LoadFromFile(*hooksFilePath)

	if err != nil {
		if !*verbose && !*noPanic {
			log.SetOutput(os.Stdout)
			log.Fatalf("couldn't load any hooks from file! %+v\naborting webhook execution since the -verbose flag is set to false.\nIf, for some reason, you want webhook to start without the hooks, either use -verbose flag, or -nopanic", err)
		}

		log.Printf("couldn't load hooks from file! %+v\n", err)
	} else {
		log.Printf("loaded %d hook(s) from file\n", len(hooks))

		for _, hook := range hooks {
			log.Printf("\t> %s\n", hook.ID)
		}
	}
}
コード例 #30
0
func main() {
	flag.Parse()
	log.SetFlags(0)
	fs := webdav.NewMemFS()
	ls := webdav.NewMemLS()
	http.Handle("/", &webdav.Handler{
		FileSystem: fs,
		LockSystem: ls,
		PropSystem: webdav.NewMemPS(fs, ls),
		Logger: func(r *http.Request, err error) {
			litmus := r.Header.Get("X-Litmus")
			if len(litmus) > 19 {
				litmus = litmus[:16] + "..."
			}

			switch r.Method {
			case "COPY", "MOVE":
				dst := ""
				if u, err := url.Parse(r.Header.Get("Destination")); err == nil {
					dst = u.Path
				}
				o := r.Header.Get("Overwrite")
				log.Printf("%-20s%-10s%-30s%-30so=%-2s%v", litmus, r.Method, r.URL.Path, dst, o, err)
			default:
				log.Printf("%-20s%-10s%-30s%v", litmus, r.Method, r.URL.Path, err)
			}
		},
	})

	addr := fmt.Sprintf(":%d", *port)
	log.Printf("Serving %v", addr)
	log.Fatal(http.ListenAndServe(addr, nil))
}