func Execute() {
	responseErrorLog := logDirectory + "/SibylServer.log"
	if _, err := os.Stat(logDirectory); os.IsNotExist(err) {
		if err := os.MkdirAll(logDirectory, 0775); err != nil {
			fmt.Printf("problems with creating the logging directory: %v", err)
			return
		}
	}

	writer, _ := rotatelogs.New(
		responseErrorLog+".%Y%m%d%H%M",
		rotatelogs.WithLinkName(responseErrorLog),
		rotatelogs.WithMaxAge(time.Hour*24),         // one day logs
		rotatelogs.WithRotationTime(time.Hour*24*7), // for seven days
	)

	hook := lfshook.NewHook(
		lfshook.WriterMap{
			logrus.InfoLevel:  writer,
			logrus.DebugLevel: writer,
			logrus.ErrorLevel: writer,
			logrus.WarnLevel:  writer,
			logrus.FatalLevel: writer,
		},
		&logrus.JSONFormatter{},
	)

	logrus.AddHook(hook)

	err := rootCmd.Execute()
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}
// Execute adds all child commands to the root command and sets flags appropriately.
// This is called by main.main(). It only needs to happen once to the rootCmd.
Execute adds all child commands to the root command and sets flags appropriately.
This is called by main.main(). It only needs to happen once to the rootCmd.
// Execute adds all child commands to the root command and sets flags appropriately . // This is called by main . main () . It only needs to happen once to the rootCmd .
func Execute() {
	responseErrorLog := logDirectory + "/SibylServer.log"
	if _, err := os.Stat(logDirectory); os.IsNotExist(err) {
		if err := os.MkdirAll(logDirectory, 0775); err != nil {
			fmt.Printf("problems with creating the logging directory: %v", err)
			return
		}
	}
	writer, _ := rotatelogs.New(
		responseErrorLog+".%Y%m%d%H%M",
		rotatelogs.WithLinkName(responseErrorLog),
		rotatelogs.WithMaxAge(time.Hour*24),         
		rotatelogs.WithRotationTime(time.Hour*24*7), 
	)
	hook := lfshook.NewHook(
		lfshook.WriterMap{
			logrus.InfoLevel:  writer,
			logrus.DebugLevel: writer,
			logrus.ErrorLevel: writer,
			logrus.WarnLevel:  writer,
			logrus.FatalLevel: writer,
		},
		&logrus.JSONFormatter{},
	)
	logrus.AddHook(hook)
	err := rootCmd.Execute()
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
}
func Execute ( ) { responseErrorLog := logDirectory + " " if _ , err := os . Stat ( logDirectory ) ; os . IsNotExist ( err ) { if err := os . MkdirAll ( logDirectory , 0775 ) ; err != nil { fmt . Printf ( " " , err ) return } } writer , _ := rotatelogs . New ( responseErrorLog + " " , rotatelogs . WithLinkName ( responseErrorLog ) , rotatelogs . WithMaxAge ( time . Hour * 24 ) , rotatelogs . WithRotationTime ( time . Hour * 24 * 7 ) , ) hook := lfshook . NewHook ( lfshook . WriterMap { logrus . InfoLevel : writer , logrus . DebugLevel : writer , logrus . ErrorLevel : writer , logrus . WarnLevel : writer , logrus . FatalLevel : writer , } , & logrus . JSONFormatter { } , ) logrus . AddHook ( hook ) err := rootCmd . Execute ( ) if err != nil { fmt . Println ( err ) os . Exit ( 1 ) } }
Execute adds all child commands to the root command and sets flags appropriately.
Execute adds all child commands to the root command and sets flags appropriately .
// one day logs // for seven days