From f428da55c8b46b1c635743e0ed01646cafbbcf8d Mon Sep 17 00:00:00 2001 From: Timothy Ye Date: Tue, 17 Apr 2018 20:42:17 +0800 Subject: [PATCH] use stdout as default log output. --- cmd/godns/godns.go | 16 ++-------------- config_sample.json | 37 ++++++++++++++++++++++--------------- 2 files changed, 24 insertions(+), 29 deletions(-) diff --git a/cmd/godns/godns.go b/cmd/godns/godns.go index 55de35c..836c53b 100644 --- a/cmd/godns/godns.go +++ b/cmd/godns/godns.go @@ -40,20 +40,8 @@ func main() { os.Exit(1) } - if configuration.LogPath == "" { - configuration.LogPath = "./godns.log" - } - - // Init log file - f, err := os.OpenFile(configuration.LogPath, os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644) - if err != nil { - fmt.Println("Failed to create log file:", configuration.LogPath) - os.Exit(1) - } - - defer f.Close() - - log.SetOutput(f) + // Init log settings + log.SetPrefix("【GoDNS】") log.Println("GoDNS started, entering main loop...") dnsLoop() } diff --git a/config_sample.json b/config_sample.json index 8749deb..7553c94 100644 --- a/config_sample.json +++ b/config_sample.json @@ -1,25 +1,32 @@ { - "provider": "DNSPod", + "provider": "DNSPod", "email": "example@gmail.com", "password": "", "login_token": "", - "domains": [{ + "domains": [ + { "domain_name": "example.com", - "sub_domains": ["www","test"] - },{ + "sub_domains": [ + "www", + "test" + ] + }, + { "domain_name": "example2.com", - "sub_domains": ["www","test"] + "sub_domains": [ + "www", + "test" + ] } ], "ip_url": "http://members.3322.org/dyndns/getip", - "log_path": "./godns.log", "socks5_proxy": "", - "notify": { - "enabled": false, - "smtp_server": "", - "smtp_username": "", - "smtp_password": "", - "smtp_port": 25, - "send_to": "" - } -} + "notify": { + "enabled": false, + "smtp_server": "", + "smtp_username": "", + "smtp_password": "", + "smtp_port": 25, + "send_to": "" + } +} \ No newline at end of file