instant infolog.txt writing [in new spring 83.0]

instant infolog.txt writing [in new spring 83.0]

Discuss Lua based Spring scripts (LuaUI widgets, mission scripts, gaia scripts, mod-rules scripts, scripted keybindings, etc...)

Moderator: Moderators

Post Reply
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

instant infolog.txt writing [in new spring 83.0]

Post by knorke »

In Spring 83.0 messages are not instantly written to infolog.txt anymore but instead buffered until spring.exe is closed.
So while modding one can not read up on all the funny error messages, isn't that annoying.

This widget makes a file instantlog.txt in the same place where there is infolog.txt and instantly writes all console/chat text to it.
It only does that when /cheat is enabled because during modding I like to have that autoenabled (put Spring.SendCommands ("cheat") somewhere in mod) but during online games it is not.
To clear the logfile just disable&renable in F11 list.
(just noticed the "try to write even if logfile==nil" is a bit fail :roll: but oh well)
Attachments
tp_instantlog.lua
(735 Bytes) Downloaded 96 times
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: instant infolog.txt writing

Post by Jools »

Thanks
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: instant infolog.txt writing

Post by hoijui »

you could also just redirect stdout and stderr to files, or to one file. that should be more reliable, and works before Lua is initialized already.
stderr will get only warnings and errors. stdout the rest.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: instant infolog.txt writing

Post by Jools »

That works great on command line, but how do you do that in windows?
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: instant infolog.txt writing

Post by knorke »

i think always running spring via a .bat file might work.
not sure if lobbies will work with that.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: instant infolog.txt writing

Post by Jools »

Yeah, but that's counterproductive to using a graphical UI in the first place. IIRC correctly people still did that with windows 95 or so.
User avatar
CarRepairer
Cursed Zero-K Developer
Posts: 3359
Joined: 07 Nov 2007, 21:48

Re: instant infolog.txt writing

Post by CarRepairer »

Get Komodo. Hit f6. Choose spring.exe and run it. Output appears at the bottom.

Also Komodo is the best editor I've ever come across.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: instant infolog.txt writing

Post by FLOZi »

Ever think to discuss this with your end users?

Even if you think it's trivial, it requires changes to peoples work flows. Which means it isn't.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: instant infolog.txt writing

Post by knorke »

in some meeting minutes it says the change was needed because some games spam so many errors that it becomes a problem for the computer.
kinda lol but maybe better for players it is better this way if it really was a problem. (which nubgame ruined it for everyone else?)

And with this thread modders now have various ways to get it "almost" like before.
I've made the thread sticky for 30 days because while it might be trivial for some, I feel like others might never have heard of stdout and such before.
User avatar
yuritch
Spring 1944 Developer
Posts: 1018
Joined: 11 Oct 2005, 07:18

Re: instant infolog.txt writing [in new spring 83.0]

Post by yuritch »

Spring is unlikely to cause a BSoD these days (which will surely result in no log except the startup stuff with the new logging btw), at least I haven't got a single Spring-related BSoD that year. I hope the log will get written after a 'normal' crash?
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: instant infolog.txt writing [in new spring 83.0]

Post by Licho »

Dont be scared of threads it doe snot have to cause slowdowns or be buffered..
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6241
Joined: 29 Apr 2005, 01:14

Re: instant infolog.txt writing

Post by FLOZi »

knorke wrote:in some meeting minutes it says the change was needed because some games spam so many errors that it becomes a problem for the computer.
kinda lol but maybe better for players it is better this way if it really was a problem. (which nubgame ruined it for everyone else?)

And with this thread modders now have various ways to get it "almost" like before.
I've made the thread sticky for 30 days because while it might be trivial for some, I feel like others might never have heard of stdout and such before.
If a game is spamming that many errors it needs fixing anyway, clearly. I've had epic lua spam in S44 many times and my computer soldiers onwards.

We shouldn't have to make do with 'almost' unless it is truly necessary - and in that case, we should be told what is being changed and why; beyond expecting us to read every detail of the minutes.

But as I said elsewhere; I am grouchy today.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: instant infolog.txt writing [in new spring 83.0]

Post by smoth »

I am not sure if I am pleased about this... I kinda like that spring freaks the fuck out when something is wrong. It means I am forced to fix it and players will notice it rather than tracking down mystery bugs.
User avatar
Licho
Zero-K Developer
Posts: 3803
Joined: 19 May 2006, 19:13

Re: instant infolog.txt writing [in new spring 83.0]

Post by Licho »

Besides the error spam will still kill spring..i doubt lag was caused by writing to file,instead writing to ingame console slows things down :)

But it wont be slowed by slow disk blocking writes...
User avatar
hoijui
Former Engine Dev
Posts: 4344
Joined: 22 Sep 2007, 09:51

Re: instant infolog.txt writing [in new spring 83.0]

Post by hoijui »

i was told, that we could still have basically instant writing to file, if we would set the output-buffer size to a low value.
already forgot again, where/how to do that.
User avatar
Jools
XTA Developer
Posts: 2816
Joined: 23 Feb 2009, 16:29

Re: instant infolog.txt writing

Post by Jools »

CarRepairer wrote:Get Komodo. Hit f6. Choose spring.exe and run it. Output appears at the bottom.

Also Komodo is the best editor I've ever come across.
Thanks, I got komodo and it works. I also like notepad++, too bad it doesn't have output like that.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: instant infolog.txt writing [in new spring 83.0]

Post by abma »

instant writing can be enabled in current development versions (and spring 89) by setting

Code: Select all

LogFlush = 1
Post Reply

Return to “Lua Scripts”