mirror of https://github.com/Xhofe/alist
				
				
				
			feat: optional log to std
							parent
							
								
									aa1c5b2be3
								
							
						
					
					
						commit
						dc000f640a
					
				| 
						 | 
				
			
			@ -6,4 +6,5 @@ var (
 | 
			
		|||
	NoPrefix    bool
 | 
			
		||||
	Dev         bool
 | 
			
		||||
	ForceBinDir bool
 | 
			
		||||
	LogStd      bool
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -29,4 +29,5 @@ func init() {
 | 
			
		|||
	RootCmd.PersistentFlags().BoolVar(&flags.NoPrefix, "no-prefix", false, "disable env prefix")
 | 
			
		||||
	RootCmd.PersistentFlags().BoolVar(&flags.Dev, "dev", false, "start with dev mode")
 | 
			
		||||
	RootCmd.PersistentFlags().BoolVar(&flags.ForceBinDir, "force-bin-dir", false, "Force to use the directory where the binary file is located as data directory")
 | 
			
		||||
	RootCmd.PersistentFlags().BoolVar(&flags.LogStd, "log-std", false, "Force to log to std")
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -46,7 +46,7 @@ func Log() {
 | 
			
		|||
			MaxAge:     logConfig.MaxAge,   //days
 | 
			
		||||
			Compress:   logConfig.Compress, // disabled by default
 | 
			
		||||
		}
 | 
			
		||||
		if flags.Debug || flags.Dev {
 | 
			
		||||
		if flags.Debug || flags.Dev || flags.LogStd {
 | 
			
		||||
			w = io.MultiWriter(os.Stdout, w)
 | 
			
		||||
		}
 | 
			
		||||
		logrus.SetOutput(w)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue