Page 1 of 1

API call to write to the game log file

Posted: Tue May 17, 2016 9:46 pm
by sparr
The original idea here was a way to get data out of the game to another process. Someone on IRC suggested alerting IRC or twitch when a rocket is launched. It occurred to me that one way to do that, which would also be generally useful, would be to just be able to write a line out to the game log file.

Re: API call to write to the game log file

Posted: Tue May 17, 2016 9:54 pm
by steinio
Hello,

you can write what you want to any file you want in script-output directory with game.write_file().
Also there is a rocket launched event - https://wiki.factorio.com/index.php?tit ... t_launched.

Now it's up to you to out them both together :)

Greetings steinio

Re: API call to write to the game log file

Posted: Wed May 18, 2016 6:50 am
by bobingabout
don't forget you also have access to log(debug.traceback())
not sure if that's specific to data code, or if it works with other things like scripting too.

Re: API call to write to the game log file

Posted: Fri May 20, 2016 6:46 pm
by Rseding91
bobingabout wrote:don't forget you also have access to log(debug.traceback())
not sure if that's specific to data code, or if it works with other things like scripting too.
log() works anywhere and writes out to the game log file.

Re: API call to write to the game log file

Posted: Fri May 20, 2016 8:38 pm
by ssilk
AH. Good, I wasn't sure. Now I can move it to implemented.