Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Log text file. Need a tool that can keep my log file open and auto reload it when it changes.


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 EddieV223   Members   -  Reputation: 751

Like
0Likes
Like

Posted 02 March 2013 - 02:39 PM

Hi I have a game I am working on, it has a logger class.  This class stores a string stream, and then dumps it to a text file when the application closes.

 

What I want to be able to do is have it open in some kind of text editor and have it reload automatically whenever the program changes the log file.  

 

However if I try to use visual studio it always prompts that the file has changed would you like to reload it, this gets very annoying after hours of programming.  I tried notepad, but it doesn't even know when the file changes and so you have to close it and reopen it again every time.  I tried word pad, it grabs control of the file and doesn't let my application modify it.  Libre office does the same thing.  

 

So what text editor can I use that will not block the file from changing but also automatically update when the file contents change?


Edited by EddieV223, 02 March 2013 - 02:40 PM.

If this post was helpful and/or constructive please give rep.

SFML2.0 Nightly Download Link http://en.sfml-dev.org/forums/index.php?topic=9513.0

SFML2.0 Tutorials http://www.sfml-dev.org/tutorials/2.0/


Ad:

#2 EWClay   Members   -  Reputation: 651

Like
0Likes
Like

Posted 02 March 2013 - 02:50 PM

I don't know a text editor that does this but what about writing to debug output as well as the text file? If you have a logger class it should be easy. You can see the output in Visual Studio or DebugView if you are not debugging.

#3 swiftcoder   Senior Moderators   -  Reputation: 4728

Like
2Likes
Like

Posted 02 March 2013 - 03:16 PM

Pretty much any decent text editor should do this. Off the top of my head, Sublime does so.

 

If you are running a unix-like environment, the relevant command line tool would be tail -f <file name>.


Tristam MacDonald - SDE @ Amazon - swiftcoding        [Need to sync your files via the cloud? | Need affordable web hosting?]


#4 akesterson   Members   -  Reputation: 138

Like
0Likes
Like

Posted 02 March 2013 - 04:01 PM

I second the "tail -f" solution. This works on windows (just install mingw, or cygwin, or gnuwin32, or any of the host of other things that can give you tail), mac os x, and all unix variants.

If youre on windows and use powershell, look into get-content, I understand it can help with this.

#5 Servant of the Lord   Marketplace Seller   -  Reputation: 8925

Like
0Likes
Like

Posted 02 March 2013 - 04:44 PM

Programmers Notepad 2 does this, iirc.

 

It doesn't constantly check, but anytime you focus on Programmer's Notepad (say, unminimizing it or bringing it to the front, or mouse-clicking it), it'll check if the file has changed and ask if you want to reload it.


All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.

Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal


#6 KulSeran   Members   -  Reputation: 1513

Like
0Likes
Like

Posted 02 March 2013 - 07:45 PM

Write out HTML compatible logs. Gives you the ability to do some nice coloring and other formatting when you output data. Shove a refresh meta tag in there and the browser will keep reloading the log page every X seconds.

#7 ifthen   Members   -  Reputation: 606

Like
0Likes
Like

Posted 03 March 2013 - 10:28 AM

I personally use PSPad. Its behaviour in these situations is similar to Programmer's Notepad mentioned by Servant of the Lord.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS