Merge pull request #150 from knoxfighter/Bugfix/log-path

fix #149
This commit is contained in:
knoxfighter 2019-05-29 19:52:00 +02:00 committed by GitHub
commit 7a1e2d3dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -264,7 +264,7 @@ func (f *FactorioServer) parseRunningCommand(std io.ReadCloser) (err error) {
}
func (f *FactorioServer) writeLog(logline string) error {
logfileName := config.FactorioDir + "factorio-server-console.log"
logfileName := filepath.Join(config.FactorioDir, "factorio-server-console.log")
file, err := os.OpenFile(logfileName, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0644)
if err != nil {
log.Printf("Cannot open logfile for appending Factorio Server output: %s", err)

View File

@ -2,13 +2,14 @@ package main
import (
"log"
"path/filepath"
"github.com/hpcloud/tail"
)
func logSubscribe(client *Client, data interface{}) {
go func() {
logfile := config.FactorioDir + "factorio-server-console.log"
logfile := filepath.Join(config.FactorioDir, "factorio-server-console.log")
t, err := tail.TailFile(logfile, tail.Config{Follow: true})
if err != nil {
log.Printf("Error subscribing to tail log %s", err)