Skip to content

Commit

Permalink
chore (log): logger init order
Browse files Browse the repository at this point in the history
  • Loading branch information
mickael-kerjean committed Mar 18, 2024
1 parent af75e96 commit da5d076
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ func start(routes *mux.Router) {
os.Exit(1)
return
}
InitLogger()
InitConfig()
InitPluginList(embed.EmbedPluginList)
for _, fn := range Hooks.Get.Onload() {
Expand Down
14 changes: 6 additions & 8 deletions server/common/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,12 @@ import (
"time"
)

var Log = func() ILogger {
l := log{}
l.Enable(true)
return &l
}()
var logfile *os.File

func init() {
var (
Log = &log{enable: true}
logfile *os.File
)

func InitLogger() {
var err error
logfile, err = os.OpenFile(GetAbsolutePath(LOG_PATH, "access.log"), os.O_APPEND|os.O_WRONLY|os.O_CREATE, os.ModePerm)
if err != nil {
Expand Down

0 comments on commit da5d076

Please sign in to comment.