<commit_before>package main

import (
	"flag"
	"log"
	"net/http"
	"net/http/httputil"
	"os"

	"github.com/droyo/meta-graphite/accesslog"
	"github.com/droyo/meta-graphite/config"
)

var (
	addr = flag.String("http", "", "address to listen on")
	file = flag.String("c", "", "configuration file")
)

func main() {
	var srv httputil.ReverseProxy

	log.SetFlags(0)
	flag.Parse()
	if *file == "" {
		log.Print("config file (-c) is required")
		flag.PrintDefaults()
		os.Exit(1)
	}
	if cfg, err := config.ParseFile(*file); err != nil {
		log.Fatalf("parse %s failed: %s", *file, err)
	} else {
		srv.Director = cfg.MapRequest
		if *addr == "" {
			*addr = cfg.Address
		}
	}
	http.Handle("/render", accesslog.Handler(&srv, nil))
	log.Fatal(http.ListenAndServe(*addr, nil))
}<commit_msg>Log a message when a server starts.<commit_after>package main

import (
	"flag"
	"log"
	"net/http"
	"net/http/httputil"
	"os"

	"github.com/droyo/meta-graphite/accesslog"
	"github.com/droyo/meta-graphite/config"
)

var (
	addr = flag.String("http", "", "address to listen on")
	file = flag.String("c", "", "configuration file")
)

func main() {
	var srv httputil.ReverseProxy

	log.SetFlags(0)
	flag.Parse()
	if *file == "" {
		log.Print("config file (-c) is required")
		flag.PrintDefaults()
		os.Exit(1)
	}
	if cfg, err := config.ParseFile(*file); err != nil {
		log.Fatalf("parse %s failed: %s", *file, err)
	} else {
		srv.Director = cfg.MapRequest
		if *addr == "" {
			*addr = cfg.Address
		}
	}
	http.Handle("/render", accesslog.Handler(&srv, nil))
	status := make(chan error)
	go func() {
		status <- http.ListenAndServe(*addr, nil)
	}()
	log.Printf("listening on %s", *addr)
	log.Fatal(<-status)
}
{'fraction_non_alphanumeric': 0.18931750741839762, 'fraction_numerical': 0.002373887240356083, 'mean_word_length': 3.817142857142857, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5717375', 'n_tokens_mistral': 699, 'n_tokens_neox': 663, 'n_words': 139}