Debug log when launched in debug-mode

hoho
Filter Inserter
Filter Inserter
Posts: 684
Joined: Sat Jan 18, 2014 11:23 am
Contact:

Debug log when launched in debug-mode

Post by hoho »

Yesterday when I tried making my first mod I had a few issues with code in data.lua. As that gets loaded during startup there is currently no way to get any meaningful information out of it and debugging problems is complicated to say the least.


What about allowing modders to use a special debug-logging method that would put text to stdout/err but only if the game is launched with e.g --debug flag? Without the flag the logging-call wouldn't do anything so it shouldn't make the game much slower for normal gameplay so that devs don't even have to comment the calls out for their releases.

I know there is the game.makefile that could be used for logging but that can't be used during startup as game object doesn't exist. In-game it's also possible to write stuff to screen but when one needs to log a lot of information for whatever reason that isn't really a viable option either.
JamesOFarrell
Filter Inserter
Filter Inserter
Posts: 402
Joined: Fri May 23, 2014 8:54 am
Contact:

Re: Debug log when launched in debug-mode

Post by JamesOFarrell »

+1. Also the ability to log the console to disk so we can debug issues that cause Factorio to crash
User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12889
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Debug log when launched in debug-mode

Post by ssilk »

print() prints to stdout, which can be piped to any file?
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...
User avatar
FreeER
Smart Inserter
Smart Inserter
Posts: 1266
Joined: Mon Feb 18, 2013 4:26 am
Contact:

Re: Debug log when launched in debug-mode

Post by FreeER »

ssilk wrote:print() prints to stdout, which can be piped to any file?
and where is stdout displayed on Windows when you launch Factorio from the gui? Or from cmd, or powershell? I've yet to find it in any of those cases, let alone be able to redirect it lol. hoho said here (though I'm not sure what OS hoho is on...)
hoho wrote:It also failied when I ran it from bash and even DebugView didn't show anything.
edit: +1 btw
And, if possible, it'd be nice if --debug would not stop after the first loading error but continue trying to load everything (obviously some would be redundant, but theoretically a help when updating mods), of course it'd still close afterwards if any errors were encountered but...maybe too much work lol
JamesOFarrell
Filter Inserter
Filter Inserter
Posts: 402
Joined: Fri May 23, 2014 8:54 am
Contact:

Re: Debug log when launched in debug-mode

Post by JamesOFarrell »

ssilk wrote:print() prints to stdout, which can be piped to any file?
So it logs to the console under Linux and OSX? As FreeER mentioned it does not work under windows.
Post Reply

Return to “Implemented mod requests”