Added a multi-writer so that log messages go to both the console and log file
	
		
			
	
		
	
	
		
	
		
			All checks were successful
		
		
	
	
		
			
				
	
				ci/woodpecker/push/woodpecker Pipeline was successful
				
			
		
		
	
	
				
					
				
			
		
			All checks were successful
		
		
	
	ci/woodpecker/push/woodpecker Pipeline was successful
				
			This commit is contained in:
		@@ -1,6 +1,7 @@
 | 
			
		||||
package config
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"io"
 | 
			
		||||
	"log"
 | 
			
		||||
	"os"
 | 
			
		||||
 | 
			
		||||
@@ -20,10 +21,12 @@ func InitLogging() *os.File {
 | 
			
		||||
		  log.Fatalf("Error opening log file: %v", err)
 | 
			
		||||
		  os.Exit(1)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		// set logging to file handle
 | 
			
		||||
		log.SetOutput(fileHandle)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// create a MultiWriter instance so we can write to both console AND file
 | 
			
		||||
	mw := io.MultiWriter(os.Stdout, fileHandle)
 | 
			
		||||
	// set our multiwriter object as the output for logging
 | 
			
		||||
	log.SetOutput(mw)
 | 
			
		||||
 | 
			
		||||
	return fileHandle
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user