This commit is contained in:
esrrhs 2019-10-28 12:11:04 +08:00
parent feba1f555a
commit b7e82c053a

View File

@ -57,6 +57,8 @@ Usage:
-nolog 不写日志文件只打印标准输出默认0 -nolog 不写日志文件只打印标准输出默认0
Do not write log files, only print standard output, default 0 is off Do not write log files, only print standard output, default 0 is off
-loglevel 日志文件等级默认info
log level, default is info
` `
func main() { func main() {
@ -74,6 +76,7 @@ func main() {
tcpmode_compress := flag.Int("tcp_gz", 0, "tcp data compress") tcpmode_compress := flag.Int("tcp_gz", 0, "tcp data compress")
nolog := flag.Int("nolog", 0, "write log file") nolog := flag.Int("nolog", 0, "write log file")
tcpmode_stat := flag.Int("tcp_stat", 0, "print tcp stat") tcpmode_stat := flag.Int("tcp_stat", 0, "print tcp stat")
loglevel := flag.String("loglevel", "info", "log level")
flag.Usage = func() { flag.Usage = func() {
fmt.Printf(usage) fmt.Printf(usage)
} }
@ -89,8 +92,12 @@ func main() {
return return
} }
level := loggo.LEVEL_INFO
if loggo.NameToLevel(*loglevel) >= 0 {
level = loggo.NameToLevel(*loglevel)
}
loggo.Ini(loggo.Config{ loggo.Ini(loggo.Config{
Level: loggo.LEVEL_INFO, Level: level,
Prefix: "pingtunnel", Prefix: "pingtunnel",
MaxDay: 3, MaxDay: 3,
NoLogFile: *nolog > 0, NoLogFile: *nolog > 0,