Vega-strike-engine-source: Proposal: Use boost::logs to capture log data

Created on 7 May 2020  路  12Comments  路  Source: vegastrike/Vega-Strike-Engine-Source

Instead of always dumping data to the console, let's capture it to a file properly. Boost provides boost::logs which can fulfill this in a platform independent way.

UPDATE: As a general rule everything should go to our log file. The exceptions:

  • getting the log going
  • fatal errors where we crash out, in which case if we can it should go to the log but should also go to the console/std::error.

We should also force a limit on log file size and do file rotations; these probably should be part of the configuration.

Proposal

Most helpful comment

@ermo yes, as a general rule everything should go to the log file. The exceptions should be:

  • getting the log going
  • fatal errors where we crash out, in which case if we can it should go to the log but should also go to the console/std::error.

All 12 comments

That's sound like some of the changes that @stephengtuggy has done in the past

@nabaco yes, there's probably something related to that. The current gitter discussion with trying to capture data to a log file got me thinking of this, so just wanted to capture it for the moment. If we already have something that can be re-enabled that'd be great and then we can pull this into one of the current milestones as a bug fix.

Yeah, basically I think my BOOST_LOG_TRIVIAL stuff just needs to be re-enabled. That is how Vega Strike does its debug output now (as opposed to stdout or stderr output, which are separate in the current version of VS).

Perhaps a Phase 2 of this issue would be redirecting everything to BOOST_LOG_TRIVIAL. No more stdout/cout/stderr/cerr.

Sounds good. @stephengtuggy are you willing to undertake this endeavor?

@stephengtuggy yes, I'd like to see everything go to file the boost logs and have only minimal output on stdout/cout/stderr/cerr - namely output before the logs can get configured and after they're shutdown, perhaps with info on where the logs are being stored too so people can easily find them.

@nabaco I'll think about it.

Possibly related to #5

@stephengtuggy #5 will have some impact certainly - though we'll have to ensure that log messages are readable enough by both users and us to be useful for actually debugging stuff too.

I was actually looking into BOOST_LOG_TRIVIAL as well and did some work on it before discovering everyone else is also thinking/working on it. @stephengtuggy since you started already, it's yours if you want it. Just be sure to assign the issue to yourself so we'll know.

Yeah, basically I think my BOOST_LOG_TRIVIAL stuff just needs to be re-enabled. That is how Vega Strike does its debug output now (as opposed to stdout or stderr output, which are separate in the current version of VS).

Perhaps a Phase 2 of this issue would be redirecting everything to BOOST_LOG_TRIVIAL. No more stdout/cout/stderr/cerr.

I'm going to leave this issue (#95) for the Phase 2 part of it. For Phase 1, re-enabling the BOOST_LOG_TRIVIAL stuff I had already put in place, I have filed #107 .

(repost from another issue)

Guys, fatal errors really ought to be printed (or at least also copied) to stderr?

Not doing so tends to break the principle of least astonishment.

Bonus points for posting a short text blurb after VS has exited with an error code, where the blurb points to the latest log file like @BenjamenMeyer also suggested.

@ermo yes, as a general rule everything should go to the log file. The exceptions should be:

  • getting the log going
  • fatal errors where we crash out, in which case if we can it should go to the log but should also go to the console/std::error.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

nabaco picture nabaco  路  4Comments

BenjamenMeyer picture BenjamenMeyer  路  3Comments

nabaco picture nabaco  路  3Comments

royfalk picture royfalk  路  6Comments

viktorradnai picture viktorradnai  路  3Comments