Skip to content

Commit ae2f09f

Browse files
committed
Add logging for SQL to annotation conversion actions
1 parent e423ad6 commit ae2f09f

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

src/main/kotlin/org/domaframework/doma/intellij/action/dao/ConvertSqlAnnotationToFileAction.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import com.intellij.psi.PsiMethod
2727
import com.intellij.psi.util.PsiTreeUtil
2828
import org.domaframework.doma.intellij.bundle.MessageBundle
2929
import org.domaframework.doma.intellij.common.psi.PsiDaoMethod
30+
import org.domaframework.doma.intellij.common.util.PluginLoggerUtil
3031
import org.domaframework.doma.intellij.extension.psi.DomaAnnotationType
3132

3233
/**
@@ -81,9 +82,18 @@ class ConvertSqlAnnotationToFileAction : PsiElementBaseIntentionAction() {
8182
// Do nothing when previewing
8283
if (IntentionPreviewUtils.isIntentionPreviewActive()) return
8384
val method = PsiTreeUtil.getParentOfType(element, PsiMethod::class.java) ?: return
85+
86+
val startTime = System.nanoTime()
8487
val converter = SqlAnnotationConverter(project, method)
8588
WriteCommandAction.runWriteCommandAction(project) {
8689
converter.convertToSqlFile()
8790
}
91+
92+
PluginLoggerUtil.countLogging(
93+
className = this::class.java.simpleName,
94+
actionName = "convertSqlAnnotationToFile",
95+
inputName = "IntentionAction",
96+
start = startTime,
97+
)
8898
}
8999
}

src/main/kotlin/org/domaframework/doma/intellij/action/dao/ConvertSqlFileToAnnotationAction.kt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import org.domaframework.doma.intellij.bundle.MessageBundle
2525
import org.domaframework.doma.intellij.common.dao.findDaoMethod
2626
import org.domaframework.doma.intellij.common.isSupportFileType
2727
import org.domaframework.doma.intellij.common.psi.PsiDaoMethod
28+
import org.domaframework.doma.intellij.common.util.PluginLoggerUtil
2829
import org.domaframework.doma.intellij.extension.psi.DomaAnnotationType
2930

3031
/**
@@ -84,9 +85,18 @@ class ConvertSqlFileToAnnotationAction : PsiElementBaseIntentionAction() {
8485
if (!isSupportFileType(element.containingFile)) return
8586

8687
val daoMethod = findDaoMethod(element.containingFile) ?: return
88+
89+
val startTime = System.nanoTime()
8790
val converter = SqlAnnotationConverter(project, daoMethod)
8891
WriteCommandAction.runWriteCommandAction(project) {
8992
converter.convertToSqlAnnotation()
9093
}
94+
95+
PluginLoggerUtil.countLogging(
96+
className = this::class.java.simpleName,
97+
actionName = "convertSqlFileToAnnotation",
98+
inputName = "IntentionAction",
99+
start = startTime,
100+
)
91101
}
92102
}

src/main/kotlin/org/domaframework/doma/intellij/formatter/processor/SqlFormatPreProcessor.kt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ class SqlFormatPreProcessor : PreFormatProcessor {
7171
if (source.language != SqlLanguage.INSTANCE && !isInjectedSqlFile(source)) {
7272
return rangeToReformat
7373
}
74+
logging()
7475

7576
// Do not execute processor processing in single-line text state
7677
if (isInjectedSqlFile(source)) {
@@ -85,8 +86,6 @@ class SqlFormatPreProcessor : PreFormatProcessor {
8586
source: PsiFile,
8687
rangeToReformat: TextRange,
8788
): ProcessResult {
88-
logging()
89-
9089
val visitor = SqlFormatVisitor()
9190
source.accept(visitor)
9291

0 commit comments

Comments
 (0)