Use Logger instead of println #126
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: Steven/fabric-example-mod#126
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
PR for #125.
@modmuss50, could you merge or close this if you find the time?
Thanks
Does this really add any benefit? I know its more correct, but is there the worry that this will add extra confusion? Everyone getting started will know about printLn, but a logger is added complexity that wont help make people less confused.
Not sure what you guys think.
I believe if people know println they would also be familiar with the concept of a logger.
If they don't know either then they'll probably stick to the one used in the template. In that case, suggesting they use the logger might be a good idea.
I agree with what was said above. They will stick to what the example uses, so we can push them in the right direction standards wise by using a logger
Edit: start as you mean to go on is probably the expression I was looking for
@modmuss50 would you reconsider now that some others have weighed in?
Why not
LOGGER.info("Hello Fabric world!")
?Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.
Should i change it?
I would, I generally dont pass the level like that in a case like this.
Alright, give me a minute.
@modmuss50 I've changed the calls as requested.
Might want to give the logger a name, for example
LogManager.getLogger("ExampleMod")
.By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.
Imo we should use the mod id for the logger name.
Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
@sfPlayer1 How would I get the mod id? Or do you mean
LogManager.getLogger("modid")
?Yes, but please add a comment to encourage using the actual mod id. I may add something to Loader to determine it from a class eventually, but for now it's not really supported.
How does this sound?
Thanks