mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-08 02:55:58 +08:00
fix cron
This commit is contained in:
@@ -3,6 +3,7 @@ package cmd
|
||||
import (
|
||||
"OpenIM/pkg/common/config"
|
||||
"OpenIM/pkg/common/constant"
|
||||
log "OpenIM/pkg/common/logger"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
@@ -19,6 +20,16 @@ func NewRootCmd() (rootCmd *RootCmd) {
|
||||
Short: "Start the server",
|
||||
Long: `Start the server`,
|
||||
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
|
||||
log.InitFromConfig(log.Config{
|
||||
JSON: true,
|
||||
Level: "",
|
||||
Sample: false,
|
||||
SampleInitial: 0,
|
||||
SampleInterval: 0,
|
||||
ItemSampleSeconds: 0,
|
||||
ItemSampleInitial: 0,
|
||||
ItemSampleInterval: 0,
|
||||
}, "newlog")
|
||||
return rootCmd.getConfFromCmdAndInit(cmd)
|
||||
},
|
||||
}
|
||||
@@ -27,6 +38,12 @@ func NewRootCmd() (rootCmd *RootCmd) {
|
||||
return rootCmd
|
||||
}
|
||||
|
||||
func (r *RootCmd) SetDesc(use, short, long string) {
|
||||
r.Command.Use = use
|
||||
r.Command.Short = short
|
||||
r.Command.Long = long
|
||||
}
|
||||
|
||||
func (r *RootCmd) addConfFlag() {
|
||||
r.Command.Flags().StringP(constant.FlagConf, "c", "", "Path to config file folder")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user