func GetLogWriter(path string, defaultWriter io.Writer) (io.Writer, error) {
	if path == "" {
		return defaultWriter, nil
	} else {
		logFile, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600)
		if err != nil {
			return nil, err
		}
		return logFile, nil
	}
}
GetLogWriter opens a file for logging, or a default io.Writer (such as stderr) for an empty path.
package main
import (
	"flag"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net/http"
	_ "net/http/pprof"
	"os"
	"path/filepath"
	"strconv"
	"time"
	"github.com/pilosa/pilosa"
)
var (
	pprof   = flag.String("addr-pprof", "", "pprof http server address")
	logFile = flag.String("log-file", "", "pilosa fragment log file")
)
func fragmentPath(sliceID int) string {
	return filepath.Join("/tmp/pilosa_range/fragments", strconv.FormatInt(int64(sliceID), 10))
}