diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-19 03:24:17 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-19 03:24:17 -0400 |
commit | 460aa3eaa96df483981e74a6992878941f11bf00 (patch) | |
tree | 61977f1291242e24c1767ee05ec4b9cb5dc3ec7d /modules/base/conf.go | |
parent | 38776a0dd5762b2efbf70ebe98eeecdcd395c185 (diff) |
optimize log
Diffstat (limited to 'modules/base/conf.go')
-rw-r--r-- | modules/base/conf.go | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/modules/base/conf.go b/modules/base/conf.go index 83c7f887..1aafd5b4 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -44,6 +44,23 @@ func exeDir() (string, error) { return path.Dir(p), nil } +func newLogService() { + log.NewLogger() +} + +func newMailService() { + // Check mailer setting. + if Cfg.MustBool("mailer", "ENABLED") { + MailService = &Mailer{ + Name: Cfg.MustValue("mailer", "NAME", AppName), + Host: Cfg.MustValue("mailer", "HOST", "127.0.0.1:25"), + User: Cfg.MustValue("mailer", "USER", "example@example.com"), + Passwd: Cfg.MustValue("mailer", "PASSWD", "******"), + } + log.Info("Mail Service Enabled") + } +} + func init() { var err error workDir, err := exeDir() @@ -72,14 +89,7 @@ func init() { AppName = Cfg.MustValue("", "APP_NAME", "Gogs: Go Git Service") Domain = Cfg.MustValue("server", "DOMAIN") - // Check mailer setting. - if Cfg.MustBool("mailer", "ENABLED") { - MailService = &Mailer{ - Name: Cfg.MustValue("mailer", "NAME", AppName), - Host: Cfg.MustValue("mailer", "HOST", "127.0.0.1:25"), - User: Cfg.MustValue("mailer", "USER", "example@example.com"), - Passwd: Cfg.MustValue("mailer", "PASSWD", "******"), - } - log.Info("Mail Service Enabled") - } + // Extensions. + newLogService() + newMailService() } |