Skip to content

Commit

Permalink
Log statements changed from debug to trace level (#516)
Browse files Browse the repository at this point in the history
* #422: Added inline verbatim description to Verbatim tag documentation

* Added tests for whitespace control for templates when New Line Trimming is enabled. Also added assertj and commons-io Maven dependencies for use in the tests. Commons IO is used to compare template output to expected output that is loaded from a file. Loading the expected template output from a file is useful for testing multiline template output, which is necessary to test various scenarios. These are a form of Integration Test rather than Unit Tests and so it is practical and reasonable to verify the template output in this way.

* Added javadoc to describe the purpose of several existing tests and changed the test method names in some cases to make the purpose of each test method more clear.

* Added a 3rd elseif in the template for the For Loop with Nested If Statement Thatis Skipped test

* Added tests with 2 ifelse in a nested if and also 3 ifelse in a nested if.

* Added test of Nested If with One ifelse statement

* Improved and added additional whitespace control tests.

* Changed Token.toString() implementation to include the line number, which I found useful to see in log statements.

* Added unit test and formatting standards to Contributing documentation page.

* Added a reference to the Jinja Python template engine, which I think provides more evidence that the Pebble syntax is good. Jinja is a very popular Python template engine.

* Added unit tests for the LexerImpl class. Also added log4j debug level log statements in LexerImpl, PebbleEngine and LexerImpl that were useful to me when trying to follow the code. Added logback-test.xml to configure the logging level. Disabled the debug logging by default.  Also removed Hamcrest Matchers and replaced references to Hamcrest in exception testing code with AssertJ. Also, changed the name of a few private methods in LexerImpl for improve clarity.

* Fixed minor text formatting in the summary statement at the top of the Home page.

* Changed log statements from debug level to trace level because debug statements were being output by default. Trace statements are not output unless configured to do so.
  • Loading branch information
nward1234 committed Jun 7, 2020
1 parent d639bb5 commit ffd36f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private PebbleTemplate getPebbleTemplate(String templateName, Loader loader, Obj
Reader templateReader = loader.getReader(cacheKey);

try {
this.logger.debug("Tokenizing template named {}", templateName);
this.logger.trace("Tokenizing template named {}", templateName);
LexerImpl lexer = new LexerImpl(this.syntax,
this.extensionRegistry.getUnaryOperators().values(),
this.extensionRegistry.getBinaryOperators().values());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private void grow(int minCapacity) {
* @param amount Amount of characters to advance by
*/
public void advance(int amount) {
logger.debug("Advancing amoun: {}", amount);
logger.trace("Advancing amount: {}", amount);
int index = 0;
while (index < amount) {
int sizeOfNewline = advanceThroughNewline(index);
Expand All @@ -141,7 +141,7 @@ public void advanceThroughWhitespace() {
index++;
}
}
logger.debug("Advanced through {} characters of whitespace.", index);
logger.trace("Advanced through {} characters of whitespace.", index);
this.size -= index;
this.offset += index;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ private File getFile(String templateName) {

templateName = templateName + (this.getSuffix() == null ? "" : this.getSuffix());

logger.debug("Looking for template in {}{}.", path.toString(), templateName);
logger.trace("Looking for template in {}{}.", path.toString(), templateName);

/*
* if template name contains path segments, move those segments into the
Expand Down

0 comments on commit ffd36f9

Please sign in to comment.