Skip to content

Commit

Permalink
Reduce production console logging
Browse files Browse the repository at this point in the history
Resolves: #38
  • Loading branch information
matshou committed Feb 5, 2021
1 parent 3b98a40 commit 3845ad6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main/java/io/yooksi/pz/zdoc/compile/JavaCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static List<JavaField> compileJavaFields(Class<?> clazz, @Nullable ZomboidAPIDoc
}
}
String format = "Didn't find matching field \"%s\" in document \"%s\"";
Logger.warn(String.format(format, field.getName(), doc.getName()));
Logger.detail(String.format(format, field.getName(), doc.getName()));
}
/* when no matching field or API page was found, construct new JavaField
* with same properties as declared field but make parameterized types null
Expand Down Expand Up @@ -179,7 +179,7 @@ static Set<JavaMethod> compileJavaMethods(Class<?> clazz, @Nullable ZomboidAPIDo
continue;
}
String format = "Didn't find matching method \"%s\" in document \"%s\"";
Logger.warn(String.format(format, method.getName(), doc.getName()));
Logger.detail(String.format(format, method.getName(), doc.getName()));
}
result.add(jMethod);
}
Expand Down Expand Up @@ -262,7 +262,7 @@ public Set<ZomboidJavaDoc> compile() {
Logger.debug(String.format("Getting API page for class \"%s\"", classPath));
document = ZomboidAPIDoc.getPage(Paths.get(classPath));
if (document == null) {
Logger.warn(String.format("Unable to find API page for path %s", classPath));
Logger.detail(String.format("Unable to find API page for path %s", classPath));
}
}
catch (IOException e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected List<JavaField> parse() {
if (type != null) {
result.add(new JavaField(type, signature.name, signature.modifier, signature.comment));
}
else Logger.warn(String.format("Excluding field (%s) from detail, " +
else Logger.detail(String.format("Excluding field (%s) from detail, " +
"class %s does not exist", signature.toString(), signature.type));
}
return result;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ protected List<JavaMethod> parse() throws DetailParsingException {
if (type == null)
{
String msg = "Excluding method (%s) from detail, class %s does not exist";
Logger.warn(String.format(msg, signature.toString(), signature.returnType));
Logger.detail(String.format(msg, signature.toString(), signature.returnType));
continue;
}
List<JavaParameter> params = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

import org.apache.logging.log4j.Level;

import io.yooksi.pz.zdoc.logger.Logger;

class SignatureParsingException extends DetailParsingException {

SignatureParsingException(String signature, String message) {
Expand All @@ -30,6 +32,6 @@ class SignatureParsingException extends DetailParsingException {
}

Level getLogLevel() {
return Level.WARN;
return Logger.VERBOSE;
}
}
2 changes: 1 addition & 1 deletion src/main/java/io/yooksi/pz/zdoc/logger/Logger.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
@SuppressWarnings("unused")
public class Logger {

public static final Level VERBOSE = Level.forName("VERBOSE", 450);
private static final String JVM_PROPERTY = "zdoc.logger";
private static final Level VERBOSE = Level.forName("VERBOSE", 450);

private static final org.apache.logging.log4j.Logger logger;
private static final LoggerType TYPE;
Expand Down

0 comments on commit 3845ad6

Please sign in to comment.