Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
chore: update logger
Stevene3fac742c5ed
diff --git a/bin/server/cmd/root.go b/bin/server/cmd/root.goindex 5a96b5b61..da9539129 100644--- a/bin/server/cmd/root.go+++ b/bin/server/cmd/root.go@@ -22,34 +22,27 @@ const (`)-type Main struct {- profile *profile.Profile-}--func (m *Main) Run() error {+func Run(profile *profile.Profile) error {ctx := context.Background()- db := DB.NewDB(m.profile)+ db := DB.NewDB(profile)if err := db.Open(ctx); err != nil {return fmt.Errorf("cannot open db: %w", err)}- s := server.NewServer(m.profile)+ s := server.NewServer(profile)- storeInstance := store.New(db.Db, m.profile)+ storeInstance := store.New(db.Db, profile)s.Store = storeInstanceprintln(greetingBanner)- fmt.Printf("Version %s has started at :%d\n", m.profile.Version, m.profile.Port)+ fmt.Printf("Version %s has started at :%d\n", profile.Version, profile.Port)return s.Run()}func Execute() {profile := profile.GetProfile()- m := Main{- profile: profile,- }println("---")println("profile")@@ -59,7 +52,7 @@ func Execute() {println("version:", profile.Version)println("---")- if err := m.Run(); err != nil {+ if err := Run(profile); err != nil {fmt.Printf("error: %+v\n", err)os.Exit(1)}diff --git a/server/server.go b/server/server.goindex 2f93d0c58..8496f2b80 100644--- a/server/server.go+++ b/server/server.go@@ -29,7 +29,9 @@ func NewServer(profile *profile.Profile) *Server {e.HidePort = truee.Use(middleware.LoggerWithConfig(middleware.LoggerConfig{- Format: "${method} ${uri} ${status}\n",+ Format: `{"time":"${time_rfc3339}",` ++ `"method":"${method}","uri":"${uri}",` ++ `"status":${status},"error":"${error}"}` + "\n",}))e.Use(middleware.CORS())