This commit is contained in:
ehlxr 2019-11-15 10:23:47 +08:00
parent 976d3852fd
commit 34859d9a5b
2 changed files with 7 additions and 4 deletions

4
.gitignore vendored
View File

@ -1,4 +1,4 @@
**.log logs
/ddgo ddgo
go.sum go.sum
dist dist

View File

@ -82,7 +82,7 @@ func initLog() {
err = log.NewFile(log.FileConfig{ err = log.NewFile(log.FileConfig{
Level: log.LevelInfo, Level: log.LevelInfo,
Filename: "ddgo.log", Filename: "./logs/ddgo.log",
FileRotationConfig: log.FileRotationConfig{ FileRotationConfig: log.FileRotationConfig{
Rotate: true, Rotate: true,
Daily: true, Daily: true,
@ -95,6 +95,10 @@ func initLog() {
func parseArg() { func parseArg() {
parser := flags.NewParser(&opts, flags.HelpFlag|flags.PassDoubleDash) parser := flags.NewParser(&opts, flags.HelpFlag|flags.PassDoubleDash)
if AppName != "" {
parser.Name = AppName
}
if _, err := parser.Parse(); err != nil { if _, err := parser.Parse(); err != nil {
if opts.Version { if opts.Version {
printVersion() printVersion()
@ -108,7 +112,6 @@ func parseArg() {
_, _ = fmt.Fprintln(os.Stderr, err) _, _ = fmt.Fprintln(os.Stderr, err)
parser.Name = AppName
parser.WriteHelp(os.Stderr) parser.WriteHelp(os.Stderr)
os.Exit(1) os.Exit(1)