-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Boost log to file #172
Boost log to file #172
Conversation
with auto rotation, free space checking, and no auto flush (because it's probably too performance-intensive)
engine/src/cmd/basecomputer.cpp
Outdated
} | ||
} | ||
|
||
fflush(stderr); | ||
// TODO: Find a way to flush the Boost logs? Console log specifically? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
part of the boost log configuration IIRC
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BenjamenMeyer yes, you can set the log sinks to auto-flush after every line of output. I have done that with the console logger, but my thinking is that that will be too much overhead with the file logger; it will slow down the game too much. So we will need a way to manually flush the file log sink when needed.
Luckily, I now have a way to do that:
VSFileSystem::pFileLogSink->flush();
I just haven't updated this file yet to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, by the way.
This way, I don't have to worry so much about whether a function/method is called before or after initLogging during the startup sequence.
OK, I think this one is ready for review. I was going to try to finish converting the entire project. But other people are working on the same files, of course, and so much is shifting around that that goal seems pretty impractical at this point. I did get the Boost logging to go to a file by default -- once it has reached the stage of game startup where it is able to. And I believe I converted quite a few of the most common and annoying messages, so they won't show up on the console anymore. What do you guys think of the log location I chose? The file logs include a timestamp in the filename. They rotate at 10 MiB, or at midnight. Logging will stop if free space on the volume drops to 1 GiB. Any other questions? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @stephengtuggy, good job. I think we can merge it, and add some documentation on the week how to use this infrastructure (maybe as art of our coding style) so future developers will know how to use it.
@stephengtuggy Thanks for the hard work that you put in. I am a little concerned about the size of the logs. If you have a rather large /home, this would mean that the files will never be deleted. Is this something you turn on, or is the boost logging on by default? For the console logs, a backup of the last log is made, and then the new log is written in it's place. This gives us a log rotation of 2, keeping the size of the thing under control. How far back in history do you want to go? It may be worth considering a log rotation scheme of 10, and compressing the backups. |
Sorry, one more commit is on the way. Need to make sure to flush the logs before exit, wherever possible. |
You're welcome. :-)
Sure, that's fine.
The boost logging is on by default, but by default, it only logs warning, error, and fatal messages. This means that during some runs of the game, no log file will be created at all. In others, only one or two messages will be logged.
That is worth considering. However, I don't know how to do that with Boost::Log. I'm not actually sure if their system supports that without some customization. Maybe a future PR can deal with that. |
There. NOW it's ready. |
Thanks. Usage instructions remain the same as before. There is at least a preliminary usage guide on the wiki here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can merge once a play test has been confirmed
I have play tested it. Do you mean you want someone else to as well? |
@stephengtuggy it would be nice if we could have a secondary person do play tests...but that's a lot of extra work so as long as we have someone willing to take ownership of the play test and affirm it I'm good. |
I'll be playing it now, just rebuilding my game engine. :) |
Thank you for submitting a pull request and becoming a contributor to the Vega Strike Core Engine.
Please answer the following:
Code Changes:
Issues:
Further implements Proposal: Use boost::logs to capture log data #95
Purpose: