Page 1 of 1

How to log my results for debug ?

Posted: Tue Nov 03, 2015 5:26 am
by MisterBrownZA
I saw there was a post by a user who used factorio.exe > my.log or something like that...

But since the update, he wasn't able to log his print() anymore.

Has a solution for this problem be found yet ?

What is the best way to investigate a table, real-time ?

It's silly that each individual modder has to investigate the table for themselves. The table data should be documented...

Re: How to log my results for debug ?

Posted: Tue Nov 03, 2015 9:07 am
by prg
MisterBrownZA wrote:I saw there was a post by a user who used factorio.exe > my.log or something like that...

But since the update, he wasn't able to log his print() anymore.

Has a solution for this problem be found yet ?
Still works fine in 0.12.16 on Linux. Are you able to reproduce this not working on Windows? What's the problem there?
MisterBrownZA wrote:What is the best way to investigate a table, real-time ?
If it's not a game object with only __self in it, print(serpent.block(table))
MisterBrownZA wrote:It's silly that each individual modder has to investigate the table for themselves. The table data should be documented...
Like https://forums.factorio.com/wiki/inde ... ua_objects?

Re: How to log my results for debug ?

Posted: Tue Nov 03, 2015 9:29 am
by MisterBrownZA
Hi prg,

thanks for the speedy response.

That's correct. I can't generate a log file using factorio.exe > debug.log.

There's no way for me to currently see a dump of the text.

Anyone know how to replicate this for windows ? Should I be running a dedicated server ?

---------------------

I will try

Code: Select all

print(serpent.block(table))
I tried using

Code: Select all

game.show_message_dialog{text = {event}}
But that expects a string, so I can't interpret a table.

Thanks for the wiki. I was getting very frustrated trying to figure everything out.

Re: How to log my results for debug ?

Posted: Tue Nov 03, 2015 10:12 am
by ratchetfreak
https://forums.factorio.com/wiki/inde ... write_file

Code: Select all

Game.write_file("MyMod_logOutput.txt", textToLog, true)

Re: How to log my results for debug ?

Posted: Wed Nov 04, 2015 5:19 am
by MisterBrownZA
ratchetfreak wrote:https://forums.factorio.com/wiki/inde ... write_file

Code: Select all

Game.write_file("MyMod_logOutput.txt", textToLog, true)
Thanks for this!

Along with that

print(serpent.block())

I'm ready to debug now! Is there a way I can close this thread ?

Re: How to log my results for debug ?

Posted: Wed Nov 04, 2015 9:28 am
by daniel34
MisterBrownZA wrote:I'm ready to debug now! Is there a way I can close this thread ?
We usually keep these threads open, in case someone has still problems with it or changes in the game make the code invalid.
Also, someone might have better ideas or can improve on existing ones.