Skip to content

Commit 9bd6544

Browse files
kalanchanpkukielka
andauthored
cherry pick 2583 (#2599)
cherry pick #2583 - allowing flexibility as we didn't inform the team on branch cut deadlines Fixes https://linear.app/sourcegraph/issue/QA-149 ## Chnages Adds detailed Cody logging, e.g. network errors. Required dev mode (e.g. `:customRunIde`) or debug logging enabled in settings for trace/debug/info messages, errors and warning are logged always. Cody Console is popping out only in dev mode regardless of the message severity. ## Test plan 1. Run `:customRunIde` - there is good chance you will notice some network errors at the start, but there should not be much of them 2. Go to the Cody settings and enable debug logging. 3. Restart IDE 4. Now you should see much more debug messages in Cody Console and in the logs ![image](https://github.com/user-attachments/assets/c7c92745-1cec-4e44-b348-22d4406ba419) ## Test plan <!-- All pull requests REQUIRE a test plan: https://sourcegraph.com/docs/dev/background-information/testing_principles Why does it matter? These test plans are there to demonstrate that are following industry standards which are important or critical for our customers. They might be read by customers or an auditor. There are meant be simple and easy to read. Simply explain what you did to ensure your changes are correct! Here are a non exhaustive list of test plan examples to help you: - Making changes on a given feature or component: - "Covered by existing tests" or "CI" for the shortest possible plan if there is zero ambiguity - "Added new tests" - "Manually tested" (if non trivial, share some output, logs, or screenshot) - Updating docs: - "previewed locally" - share a screenshot if you want to be thorough - Updating deps, that would typically fail immediately in CI if incorrect - "CI" - "locally tested" --> Co-authored-by: Piotr Kukiełka <pkukielka@users.noreply.github.com>
1 parent c66fc78 commit 9bd6544

File tree

1 file changed

+17
-18
lines changed

1 file changed

+17
-18
lines changed

src/main/kotlin/com/sourcegraph/cody/error/CodyConsole.kt

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,29 +20,28 @@ class CodyConsole(project: Project) {
2020
var content: Content? = null
2121

2222
fun addMessage(message: DebugMessage) {
23-
if (ConfigUtil.isCodyDebugEnabled()) {
24-
runInEdt {
25-
val messageText = "${message.channel}: ${message.message}\n"
26-
if (message.message.contains("ERROR") || message.message.contains("PANIC")) {
27-
toolWindow?.show()
28-
content?.let { toolWindow?.contentManager?.setSelectedContent(it) }
29-
consoleView.print(messageText, ConsoleViewContentType.ERROR_OUTPUT)
30-
logger.error(messageText)
31-
} else {
32-
consoleView.print(messageText, ConsoleViewContentType.NORMAL_OUTPUT)
33-
logger.info(messageText)
34-
}
23+
runInEdt {
24+
val messageText = "${message.channel}: ${message.message}\n"
25+
if (message.level == "error" || message.level == "warn") {
26+
content?.let { toolWindow?.contentManager?.setSelectedContent(it) }
27+
consoleView.print(messageText, ConsoleViewContentType.ERROR_OUTPUT)
28+
logger.warn(messageText)
29+
} else if (ConfigUtil.isCodyDebugEnabled()) {
30+
consoleView.print(messageText, ConsoleViewContentType.NORMAL_OUTPUT)
31+
logger.info(messageText)
32+
}
33+
34+
if (ConfigUtil.isCodyDebugEnabled()) {
35+
toolWindow?.show()
3536
}
3637
}
3738
}
3839

3940
init {
40-
if (ConfigUtil.isCodyDebugEnabled()) {
41-
runInEdt {
42-
val factory = toolWindow?.contentManager?.factory
43-
content = factory?.createContent(consoleView.component, "Cody Console", true)
44-
content?.let { toolWindow?.contentManager?.addContent(it) }
45-
}
41+
runInEdt {
42+
val factory = toolWindow?.contentManager?.factory
43+
content = factory?.createContent(consoleView.component, "Cody Console", true)
44+
content?.let { toolWindow?.contentManager?.addContent(it) }
4645
}
4746
}
4847

0 commit comments

Comments
 (0)