Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional information in logs #219

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/main/kotlin/com/vk/admstorm/utils/MyUtils.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.vk.admstorm.utils

import com.intellij.ide.plugins.PluginManagerCore
import com.intellij.openapi.application.ApplicationInfo
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.PathManager
import com.intellij.openapi.application.invokeAndWaitIfNeeded
Expand All @@ -13,6 +15,7 @@ import com.intellij.openapi.project.Project
import com.intellij.openapi.project.guessProjectDir
import com.intellij.openapi.util.NlsContexts
import com.intellij.openapi.util.Ref
import com.intellij.openapi.util.SystemInfo
import com.intellij.openapi.vfs.LocalFileSystem
import com.intellij.openapi.vfs.VirtualFile
import com.intellij.psi.PsiFile
Expand Down Expand Up @@ -98,6 +101,21 @@ object MyUtils {
return result.toString().removeSuffix("\n")
}

private fun getInternalLogInfo(): String {
val pluginsList = PluginManagerCore.getPlugins().associate { item ->
item.pluginId to item.name
}.entries.joinToString("\n") { pair ->
"${pair.key} => ${pair.value}"
}

return "OS_Name: ${SystemInfo.OS_NAME} \n" +
"OS_Version: ${SystemInfo.OS_VERSION} \n" +
"OS_Arch: ${SystemInfo.OS_ARCH} \n" +
"IDE_version: ${ApplicationInfo.getInstance().fullVersion} \n" +
"IDE_plugins: \n" +
pluginsList + "\n"
}

fun readIdeaLogFile(full: Boolean = false): String {
val logFile = File(PathManager.getLogPath(), "idea.log")
val countNeedLines = if (full) {
Expand All @@ -114,7 +132,7 @@ object MyUtils {
lines += "$line\n"
}

return lines
return getInternalLogInfo() + lines
}

fun virtualFileByRelativePath(project: Project, filepath: String): VirtualFile? {
Expand Down
Loading