mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-05-14 05:52:43 +00:00
optimize log
This commit is contained in:
parent
38776a0dd5
commit
460aa3eaa9
4 changed files with 77 additions and 15 deletions
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue