Skip to content

Commit

Permalink
Log rendered template content at TRACE level only
Browse files Browse the repository at this point in the history
more QoL for the DEBUG level, basically
  • Loading branch information
Tristan971 committed Jan 13, 2025
1 parent 9fc5c4a commit cba0a82
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/org/mangadex/mcw/render/RenderService.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ public Render render(String template) throws IOException {
.mapToLong(ResolvedServer::ttl)
.min()
.orElse(Long.MAX_VALUE); // empty result, essentially
LOGGER.debug("Resolved pool[{}]->servers into {} (ttl={}s)", poolName, poolServers, poolTTL);
LOGGER.trace("Resolved pool[{}]->servers into {} (ttl={}s)", poolName, poolServers, poolTTL);

minDnsTTL = min(poolTTL, minDnsTTL);

var poolHostPorts = poolServers.stream().map(ResolvedServer::value).map(TextNode::new).toList();
LOGGER.debug("Final pool[{}]->servers = {}", poolName, poolHostPorts);
LOGGER.debug("Resolved pool[{}]->servers = {} (ttl={}s)", poolName, poolHostPorts, poolTTL);

var serversNode = pool.withArrayProperty("servers");
serversNode.removeAll();
Expand All @@ -94,7 +94,13 @@ public Render render(String template) throws IOException {
var renderTTL = max(minTTL, min(minDnsTTL, maxTTL));

var rendered = objectMapper.writeValueAsString(root);
LOGGER.debug("Rendered template (ttl={}s) with content \n{}", renderTTL, rendered);

if (LOGGER.isTraceEnabled()) {
LOGGER.trace("Rendered template with ttl={}s and content '{}'", renderTTL, rendered);
} else if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Rendered template with ttl={}s", renderTTL);
}

return new Render(rendered, renderTTL);
}

Expand Down

0 comments on commit cba0a82

Please sign in to comment.