Skip to content

Commit

Permalink
Reduce log verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
javiertuya committed Aug 13, 2024
1 parent 58da6a8 commit 3e032a2
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,12 @@ public void resolve(Map<String, Schema> oaSchemas) {
String attribute = oaProperty.getKey();
log.trace("Check for ids at property: {}", attribute);
if (isUid(entity, attribute)) {
log.debug("*found uid by convention: schema object: {} property: {}", entity, attribute);
log.debug("Found uid by convention: schema object: {} property: {}", entity, attribute);
addExtension(oaProperty.getValue(), OaExtensions.X_PK, "true");
} else {
String rid = getRid(entity, attribute);
if (!"".equals(rid)) {
log.debug("*found rid by convention: schema object: {} property: {} rid value: {}", entity, attribute, rid);
log.debug("Found rid by convention: schema object: {} property: {} rid value: {}", entity, attribute, rid);
addExtension(oaProperty.getValue(), OaExtensions.X_FK, rid);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ else if ("put".equals(method))
String ref = schema.get$ref();
if (ref == null)
return null;
log.debug("Found post, body ref: {}", ref);
log.trace("Found post, body ref: {}", ref);
return ref;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ TdEntity createNewEntity(String name, TdEntity upstream) {
}

void addEntity(TdEntity entity) {
log.debug("*add entity if does not exists {}", entity.getName());
log.trace("*Add entity if does not exists {}", entity.getName());
tdSchema.addEntitiesItemIfNotExist(entity);
}

Expand Down Expand Up @@ -232,7 +232,7 @@ private void setAttributeIds(Schema<?> oaProperty, TdAttribute attribute, TdEnti
if (extensions == null)
return;
for (Entry<String, Object> oaExtension : extensions.entrySet()) {
log.debug("*update uids/rids: {}, column: {}", oaExtension.getKey(), attribute.getName());
log.trace("Update uids/rids: {}, column: {}", oaExtension.getKey(), attribute.getName());
if (OaExtensions.X_PK.equals(oaExtension.getKey()))
attribute.uid("true"); // does not check the value, the presence of x-pk is enough
else if (OaExtensions.X_FK.equals(oaExtension.getKey())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public Object getPayload(Class clazz) {
*/
public void putPayload(Object result) {
FileUtil.fileWrite(cacheFile, serializer.serialize(result, true));
log.debug("Cache {} {} update: {}", endpoint, hash, result);
log.debug("Cache {} {} update.", endpoint, hash);
}

private void ensureCacheFolder(String cacheFolder, String endpoint) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public void endWrite() {
return;
}
boolean usePut = resolver.usePut(this.currentEntity);
log.trace("endWrite: {} to url {}", usePut ? "PUT" : "POST", url);
log.debug("endWrite: sending {} to url {}", usePut ? "PUT" : "POST", url);

ApiWriter writer = resolver.getApiWriter().reset();
if (authStore != null) // Store or set credentials, if applicable
Expand All @@ -74,7 +74,7 @@ public void endWrite() {
String reason = response.getReason();
String body = response.getBody();
String message = status + " " + reason + " - body: " + body;
log.trace("endWrite: response={}", message);
log.debug("endWrite: response={}", message);

// Check the status and raises exception. Currently, only 2xx statuses are valid.
if (status / 100 != 2) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ public ApiWriter getApiWriter() {
@Override
public String getEndpointPath(String entityName) {
if (this.model == null) {
log.debug("No model set, resolving endpoint by entity name");
log.debug("No model set, resolving endpoint for entity {} by entity name", entityName);
return this.url + "/" + entityName.toLowerCase();
}
// find a path in the model
List<Ddl> ddls = this.model.getEntity(entityName).getDdls();
for (Ddl ddl : giis.tdrules.model.ModelUtil.safe(ddls))
if ("post".equals(ddl.getCommand())) {
log.debug("Resolving endpoint for entity {} from the model: {}", entityName, ddl.getQuery());
log.trace("Resolving endpoint for entity {} from the model: {}", entityName, ddl.getQuery());
return this.url + ddl.getQuery();
}
// not found uses the entity name as fallback
Expand Down

0 comments on commit 3e032a2

Please sign in to comment.