Use Logger instead of println #126

Merged
StoneLabs merged 4 commits from patch-1 into 1.17 2021-09-22 11:25:04 +00:00
Showing only changes of commit 962b5dedbb - Show all commits

View File

@ -5,7 +5,10 @@ import org.apache.logging.log4j.LogManager;
modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```
import org.apache.logging.log4j.Logger;
public class ExampleMod implements ModInitializer {
public static final Logger LOGGER = LogManager.getLogger();
modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```
// This logger is used to write text to the console and the log file.
modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```
// It is considered best practice to use your mod id as the logger's name.
modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```
// That way, it's clear which mod wrote info, warnings, and errors.
modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```
public static final Logger LOGGER = LogManager.getLogger("modid");
modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```
@Override
public void onInitialize() {

modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
modmuss50 commented 2021-09-21 11:58:06 +00:00 (Migrated from github.com)
Review

Why not LOGGER.info("Hello Fabric world!")?

Why not `LOGGER.info("Hello Fabric world!")`?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
StoneLabs commented 2021-09-21 11:59:05 +00:00 (Migrated from github.com)
Review

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO.

Should i change it?

Would be fine with me, i just thought this would more obviously hint towards other options besides INFO. Should i change it?
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
modmuss50 commented 2021-09-21 12:00:57 +00:00 (Migrated from github.com)
Review

I would, I generally dont pass the level like that in a case like this.

I would, I generally dont pass the level like that in a case like this.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
StoneLabs commented 2021-09-21 12:02:05 +00:00 (Migrated from github.com)
Review

Alright, give me a minute.

Alright, give me a minute.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
Technici4n commented 2021-09-21 12:36:52 +00:00 (Migrated from github.com)
Review

Might want to give the logger a name, for example LogManager.getLogger("ExampleMod").

Might want to give the logger a name, for example `LogManager.getLogger("ExampleMod")`.
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
StoneLabs commented 2021-09-21 12:45:09 +00:00 (Migrated from github.com)
Review

By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways.

// Returns a Logger with the name of the calling class.
// Returns:
//     The Logger for the calling class.
// Throws:
//     UnsupportedOperationException – if the calling class cannot be determined.
public static Logger getLogger() {
    return getLogger(StackLocatorUtil.getCallerClass(2));
}
By default, the getLogger will use the Caller's class name. So that would be ExampleMod anyways. ```java // Returns a Logger with the name of the calling class. // Returns: // The Logger for the calling class. // Throws: // UnsupportedOperationException – if the calling class cannot be determined. public static Logger getLogger() { return getLogger(StackLocatorUtil.getCallerClass(2)); } ```
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
liach commented 2021-09-21 14:29:07 +00:00 (Migrated from github.com)
Review

Imo we should use the mod id for the logger name.

Imo we should use the mod id for the logger name.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
sfPlayer1 commented 2021-09-21 19:35:29 +00:00 (Migrated from github.com)
Review

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.

Yes, definitely mod id. It is the most useful for the end user and we want to promote best practices.
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
StoneLabs commented 2021-09-21 21:33:16 +00:00 (Migrated from github.com)
Review

@sfPlayer1 How would I get the mod id? Or do you mean LogManager.getLogger("modid")?

@sfPlayer1 How would I get the mod id? Or do you mean `LogManager.getLogger("modid")`?
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
sfPlayer1 commented 2021-09-21 21:38:17 +00:00 (Migrated from github.com)
Review

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.

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.
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```
StoneLabs commented 2021-09-21 21:47:40 +00:00 (Migrated from github.com)
Review

How does this sound?

// This logger is used to write text to the console and the log file.
// It is considered best practice to use your mod id as the logger's name.
// That way, it's clear which mod wrote info, warnings, and errors.
public static final Logger LOGGER = LogManager.getLogger("modid");
How does this sound? ```java // This logger is used to write text to the console and the log file. // It is considered best practice to use your mod id as the logger's name. // That way, it's clear which mod wrote info, warnings, and errors. public static final Logger LOGGER = LogManager.getLogger("modid"); ```