func ChangeLogFile(logPath string) {
	muLog.Lock()
	defer muLog.Unlock()
	if proxyLogFilePath == logPath {
		return
	}
	closeLogFile()
	openLogFile(logPath)
}
ChangeLogFile changes name of log file
package httplogproxy
import (
	"bytes"
	"encoding/json"
	"fmt"
	"io"
	"io/ioutil"
	"log"
	"net"
	"net/http"
	"net/http/httputil"
	"os"
	"os/signal"
	"path/filepath"
	"strings"
	"sync"
	"sync/atomic"
	"github.com/elazarl/goproxy"
	"github.com/elazarl/goproxy/transport"
)
var (
	tr               = transport.Transport{Proxy: transport.ProxyFromEnvironment}
	proxyLogFilePath string
	proxyLogFile     *os.File
	sessionID        int32
	muLog            sync.Mutex
)
func getNextSessionID() int {
	v := atomic.AddInt32(&sessionID, 1)
	return int(v)
}
func clearSessionID() {
	atomic.StoreInt32(&sessionID, 0)
}
func must(err error) {
	if err != nil {
		panic(err.Error())
	}
}
func panicIf(cond bool, format string, args ...interface{}) {
	if cond {
		s := fmt.Sprintf(format, args...)
		panic(s)
	}
}
func valueOrDefault(value, def string) string {
	if value != "" {
		return value
	}
	return def
}
func openLogFile(logPath string) {
	if logPath == "" {
		return
	}
	dir := filepath.Dir(logPath)
	err := os.MkdirAll(dir, 0755)
	must(err)
	f, err := os.Create(logPath)
	must(err)
	proxyLogFile = f
	proxyLogFilePath = logPath
	fmt.Printf("Logging to %s\n", logPath)
	clearSessionID()
}
func closeLogFile() {
	if proxyLogFile != nil {
		proxyLogFile.Close()
		proxyLogFile = nil
	}
}
func CloseLogFile() {
	lgShort("")
	muLog.Lock()
	defer muLog.Unlock()
	closeLogFile()
}