Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upSetup basic logging #513
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Dec 23, 2017
Member
Reviewed 20 of 20 files at r1.
Review status: all files reviewed at latest revision, all discussions resolved.
Comments from Reviewable
|
Reviewed 20 of 20 files at r1. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Dec 23, 2017
Member
I like this a lot! Thank you!
Question for @amethyst/engine-devs and @Rhuagh though, A lot of our crates are starting to get these common dependencies, such as log and shrev. Perhaps we should identify our "framework dependencies" and re-export them in core just to make maintenance easier. (Much like I did with cgmath)
|
I like this a lot! Thank you! Question for @amethyst/engine-devs and @Rhuagh though, A lot of our crates are starting to get these common dependencies, such as |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Dec 23, 2017
Member
We have to be careful though because if we do this with private dependencies (which log is) we would have to make a breaking change when we upgrade them.
|
We have to be careful though because if we do this with private dependencies (which log is) we would have to make a breaking change when we upgrade them. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
So..any suggestions for the logger implementation? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Dec 24, 2017
Member
I'm content with the idea of having to make breaking changes when upgrading log, chances are pretty good users are going to want to log their own things too. (I know I've done this for a few games I've worked on)
|
I'm content with the idea of having to make breaking changes when upgrading log, chances are pretty good users are going to want to log their own things too. (I know I've done this for a few games I've worked on) |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Dec 24, 2017
Member
Ah, nicely observed @Xaeroxe. I think it's okay to expose the log crate then
|
Ah, nicely observed @Xaeroxe. I think it's okay to expose the |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Dec 25, 2017
Member
simple_logger for examples imho.
Review status:
all files reviewed at latest revision, all discussions resolved, all commit checks successful.
Comments from Reviewable
|
Review status: Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Dec 25, 2017
Member
Only problem with that is that the last commit was two years ago :( It looks pretty much like env_logger, so we could as well just use that.
|
Only problem with that is that the last commit was two years ago :( It looks pretty much like |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Dec 25, 2017
Member
That or simplelog, I don't mind either. For production games it will likely be log4rs or similar
|
That or |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
|
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 3, 2018
Member
Use env_logger for the examples. How far is this from completion?
Review status:
all files reviewed at latest revision, all discussions resolved, all commit checks successful.
Comments from Reviewable
|
Use Review status: Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 3, 2018
Member
This is pretty easy to complete, and I planned to use fern. Just didn't have time for it yet.
|
This is pretty easy to complete, and I planned to use fern. Just didn't have time for it yet. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Ok. Use |
bors
bot
closed this
Jan 6, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Bad robot |
Xaeroxe
reopened this
Jan 6, 2018
torkleyy
added
status: stalled
status: ready
and removed
status: working
status: stalled
labels
Jan 8, 2018
torkleyy
added some commits
Dec 22, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 13, 2018
Member
Example output:
[amethyst::app][INFO] Initializing Amethyst...
[amethyst::app][INFO] Version: v0.5.1-398-g40fa47b
[amethyst::app][INFO] Platform: x86_64-unknown-linux-gnu
[amethyst::app][INFO] Amethyst git commit: 40fa47ba289cc87f5fc927a2939e071adff21af0
[amethyst::app][INFO] Rustc version: 1.25.0-nightly Nightly
[amethyst::app][INFO] Rustc git commit: 51b0b3734cbd0ca58c8be3512d53fce2d95f40dd
[amethyst::app][INFO] Engine is shutting down
Color may be added later.
|
Example output:
Color may be added later. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 13, 2018
Member
I'd say this is ready for merge; we want to add a logging config later, but we can now finally use logging when creating a PR and don't have to use printlns and remove them at the end :)
|
I'd say this is ready for merge; we want to add a logging config later, but we can now finally use logging when creating a PR and don't have to use |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 14, 2018
Member
Atm this will just log to stdout. As I said above, we need to add a logging configuration, but this PR is helpful as is.
|
Atm this will just log to stdout. As I said above, we need to add a logging configuration, but this PR is helpful as is. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Emilgardis
Jan 14, 2018
Contributor
An easy way to make this configurable for now is to add one function to App and change App::new
App::new:fn new<P: AsRef<Path>>(path: P, initial_state: T) -> Result<Self>
usesApp::with_loggerinternally, using the default loggerApp::with_logger:fn with_logger<P: AsRef<Path>>(path: P, initial_state: T, logger: fern::Dispatch) -> Result<Self>
|
An easy way to make this configurable for now is to add one function to
|
| @@ -6,5 +6,5 @@ | ||
| multisampling: 1, | ||
| title: "Sphere example", | ||
| visibility: true, | ||
| - vsync: true, | ||
| + vsync: false, |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 15, 2018
Member
I forgot to reset it after running the example (glutin bug currently causes a crash when using vsync).
torkleyy
Jan 15, 2018
Member
I forgot to reset it after running the example (glutin bug currently causes a crash when using vsync).
| @@ -151,6 +154,8 @@ impl<'a, 'b> Application<'a, 'b> { | ||
| /// Advances the game world by one tick. | ||
| fn advance_frame(&mut self) { | ||
| + trace!("Advancing frame (`Application::advance_frame`)"); |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Jan 15, 2018
Member
Are we sure we want this? That's rather a lot of logging for anyone who subscribes to trace events. Advancing the frame is somewhat mundane and not really noteworthy.
Xaeroxe
Jan 15, 2018
Member
Are we sure we want this? That's rather a lot of logging for anyone who subscribes to trace events. Advancing the frame is somewhat mundane and not really noteworthy.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 15, 2018
Member
Well you usually filter the logging at this level (if you don't, you shouldn't expect to get only a few lines of output). The whole point of trace is to provide information you'll almost never need, but can be quite helpful to localize a bug in very rare cases.
torkleyy
Jan 15, 2018
Member
Well you usually filter the logging at this level (if you don't, you shouldn't expect to get only a few lines of output). The whole point of trace is to provide information you'll almost never need, but can be quite helpful to localize a bug in very rare cases.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 15, 2018
Member
Reviewed 2 of 6 files at r2, 6 of 6 files at r3.
Review status: all files reviewed at latest revision, 3 unresolved discussions.
src/app.rs, line 316 at r3 (raw file):
use rustc_version_runtime; fern::Dispatch::new()
Add a with_logger function on ApplicationBuilder, and use this as the fallback in the build function?
Comments from Reviewable
|
Reviewed 2 of 6 files at r2, 6 of 6 files at r3. src/app.rs, line 316 at r3 (raw file):
Add a Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Rhuagh
Jan 16, 2018
Member
Review status: all files reviewed at latest revision, 2 unresolved discussions.
src/app.rs, line 316 at r3 (raw file):
Previously, Rhuagh (Simon Rönnberg) wrote…
Add a
with_loggerfunction onApplicationBuilder, and use this as the fallback in thebuildfunction?
Actually, just put this in a with_default_logger(mut self) -> Self {}
Comments from Reviewable
|
Review status: all files reviewed at latest revision, 2 unresolved discussions. src/app.rs, line 316 at r3 (raw file): Previously, Rhuagh (Simon Rönnberg) wrote…
Actually, just put this in a Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Jan 16, 2018
Member
Problem is we don't get all the initialization messages if the logger setup is in a builder method.
|
Problem is we don't get all the initialization messages if the logger setup is in a builder method. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Hrmph, I guess that's true. |
bot
added a commit
that referenced
this pull request
Jan 17, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Timed out |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Xaeroxe
Jan 17, 2018
Member
Reviewed 13 of 20 files at r1, 2 of 6 files at r2, 6 of 6 files at r3.
Review status: all files reviewed at latest revision, 1 unresolved discussion, some commit checks failed.
Comments from Reviewable
|
Reviewed 13 of 20 files at r1, 2 of 6 files at r2, 6 of 6 files at r3. Comments from Reviewable |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Overriding |
Xaeroxe
merged commit b2e2637
into
amethyst:develop
Jan 17, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Emilgardis
Jan 19, 2018
Contributor
This needs to be documented somewhere. Even though it is roughly implemented, making an effort to document it should make it clearer on how to do this properly.
|
This needs to be documented somewhere. Even though it is roughly implemented, making an effort to document it should make it clearer on how to do this properly. |
torkleyy commentedDec 22, 2017
•
edited
Edited 1 time
-
torkleyy
edited Dec 22, 2017 (most recent)
TODO: decide on a simple logging implementation and initialize it in the
ApplicationThis change is