Skip to content

Commit

Permalink
Fix #341, add trace logging to resolveMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
sbglasius committed Apr 8, 2024
1 parent a64ac4e commit acd5678
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ package grails.plugin.formfields

import grails.core.GrailsApplication
import groovy.transform.CompileStatic
import groovy.util.logging.Slf4j
import groovy.xml.MarkupBuilder
import org.apache.commons.lang.StringUtils
import org.grails.buffer.FastStringWriter
Expand All @@ -44,6 +45,7 @@ import java.text.NumberFormat

import static FormFieldsTemplateService.toPropertyNameFormat

@Slf4j
class FormFieldsTagLib {
static final namespace = 'f'

Expand Down Expand Up @@ -615,6 +617,9 @@ class FormFieldsTagLib {
def message = keysInPreferenceOrder.findResult { key ->
message(code: key, default: null) ?: null
}
if(log.traceEnabled && !message) {
log.trace("i18n missing translation for one of ${keysInPreferenceOrder}")
}
message ?: defaultMessage
}

Expand Down

2 comments on commit acd5678

@matrei
Copy link
Contributor

@matrei matrei commented on acd5678 Apr 15, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sbglasius I believe the @Slf4j annotation will add a if (log.isTraceEnabled()) around the log statement, so the condition can be simplified to if (!message).

@sbglasius
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right. I will simplify that shortly.

Please sign in to comment.