mirror of
https://github.com/OpenFactorioServerManager/factorio-server-manager.git
synced 2025-01-10 04:19:38 +02:00
24 lines
383 B
Go
24 lines
383 B
Go
package main
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/hpcloud/tail"
|
|
)
|
|
|
|
func tailLog(filename string) ([]string, error) {
|
|
result := []string{}
|
|
|
|
t, err := tail.TailFile(config.FactorioLog, tail.Config{Follow: false})
|
|
if err != nil {
|
|
log.Printf("Error tailing log %s", err)
|
|
return result, err
|
|
}
|
|
|
|
for line := range t.Lines {
|
|
result = append(result, line.Text)
|
|
}
|
|
|
|
return result, nil
|
|
}
|