Author Topic: Console, stdout and stderr  (Read 1058 times)

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Console, stdout and stderr
« on: 11 April 2010, 14:22:14 »

Quote from: From Revision: 574
* hide console on Windows, stdout and stderr redirected to stdout.txt and stderr.txt

Running multiple instances of GAE with separate data directories for each would be ok but I often run multiple instances with the same data directory. I'm thinking this might cause problems if they're both trying to write to the same file. I haven't tested anything though.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Console, stdout and stderr
« Reply #1 on: 13 April 2010, 08:43:52 »
how about,

Code: [Select]
#if _GAE_DEBUG_EDITION_ || !defined(NDEBUG)
#   define MAIN_FUNCTION(X) /*the old code, console + no redirect */
#else
#   define MAIN_FUNCTION(X) /*the new code, no console + std out/err redirect */
#endif

Sufficient ?
Glest Advanced Engine - Code Monkey

Timeline | Downloads

hailstone

  • Local Moderator
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: Console, stdout and stderr
« Reply #2 on: 17 April 2010, 00:36:46 »
Yes, this should work. Thanks.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

softcoder

  • MegaGlest Team
  • Battle Machine
  • ********
  • Posts: 2,239
    • View Profile
Re: Console, stdout and stderr
« Reply #3 on: 17 April 2010, 19:25:49 »
Hey guys you could snag some code from mega-glest to do this. I added some cross platform code that kinda autodetects if one instance of MG has debug.log locked and if so the next instance will create a different logfile. You can check out util.cpp in the method:

SystemFlags::OutputDebug() and its related code to see how I did it.

Might be useful for other stuff to, anyways just a thought :)

silnarm

  • Local Moderator
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: Console, stdout and stderr
« Reply #4 on: 18 April 2010, 07:39:40 »
SystemFlags::OutputDebug() ...

Might be useful for other stuff to, anyways just a thought :)

Network logging goes to client or server specific logs already, that's generally good enough for our purposes, so I'll leave it ;) ... if someone else wants to snag it...

For the SystemFlags::OutputDebug() code spam, no thanks  :-X I'll stick with my trusty old debugger ;)  On the more positive side, you've inspired me to add a _TRACE_FUNCTION() macro [conditionally compiled, of course...]
Glest Advanced Engine - Code Monkey

Timeline | Downloads

 

anything