func logName(tag string, t time.Time) (name, link string) {
	name = fmt.Sprintf("%s.%s.%s.log.%s.%04d%02d%02d-%02d%02d%02d.%d",
		program,
		host,
		getUserName(),
		tag,
		t.Year(),
		t.Month(),
		t.Day(),
		t.Hour(),
		t.Minute(),
		t.Second(),
		pid)
	return name, program + "." + tag
}
logName returns a new log file name containing tag, with start time t, and
the name for the symlink for tag.
package klog
import (
	"errors"
	"fmt"
	"os"
	"os/user"
	"path/filepath"
	"runtime"
	"strings"
	"sync"
	"time"
)
var MaxSize uint64 = 1024 * 1024 * 1800
var logDirs []string
func createLogDirs() {
	if logging.logDir != "" {
		logDirs = append(logDirs, logging.logDir)
	}
	logDirs = append(logDirs, os.TempDir())
}
var (
	pid          = os.Getpid()
	program      = filepath.Base(os.Args[0])
	host         = "unknownhost"
	userName     = "unknownuser"
	userNameOnce sync.Once
)
func init() {
	if h, err := os.Hostname(); err == nil {
		host = shortHostname(h)
	}
}
func getUserName() string {
	userNameOnce.Do(func() {
		if runtime.GOOS == "windows" {
			u := os.Getenv("USERNAME")
			if len(u) == 0 {
				return
			}
			u = strings.Replace(u, `\`, "_", -1)
			d := os.Getenv("USERDOMAIN")
			if len(d) != 0 {
				userName = d + "_" + u
			} else {
				userName = u
			}
		} else {
			current, err := user.Current()
			if err == nil {
				userName = current.Username
			}
		}
	})
	return userName
}
func shortHostname(hostname string) string {
	if i := strings.Index(hostname, "."); i >= 0 {
		return hostname[:i]
	}
	return hostname
}