Added option to select a file for chat-logs (#310)

This commit is contained in:
Matthijs
2022-02-11 01:29:14 +01:00
committed by GitHub
parent 799c2dbb82
commit e7197c9cfd
2 changed files with 7 additions and 1 deletions
+2 -1
View File
@@ -62,7 +62,8 @@ type Config struct {
Autostart string `json:"-"`
ConsoleCacheSize int `json:"console_cache_size,omitempty"` // the amount of cached lines, inside the factorio output cache
ConsoleLogFile string `json:"console_log_file,omitempty"`
Secure bool `json:"secure"` // set to `false` to use this tool without SSL/TLS (Default: `true`)
ChatLogFile string `json:"chat_log_file,omitempty"` // separate log file for chat (incl join/quit)
Secure bool `json:"secure"` // set to `false` to use this tool without SSL/TLS (Default: `true`)
}
// set Configs default values. JSON unmarshal will replace when it found something different
+5
View File
@@ -273,6 +273,11 @@ func (server *Server) Run() error {
server.Cmd = exec.Command(config.FactorioBinary, args...)
}
// Write chat log to a different file if requested (if not it will be mixed-in with the default logfile)
if config.ChatLogFile != "" {
args = append(args, "--console-log", config.ChatLogFile)
}
server.StdOut, err = server.Cmd.StdoutPipe()
if err != nil {
log.Printf("Error opening stdout pipe: %s", err)