Skip to content

Commit 72160a3

Browse files
tomaszgolebiowskiTomasz Gołębiowski
andauthored
Make debug logs enabled by configuration file (#328)
This PR adds the ability to enable logging at the debug level via a configuration file. Previously, such logging was only possible when compiling in debug mode. ## Test plan N/A <!-- REQUIRED; info at https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles --> --------- Co-authored-by: Tomasz Gołębiowski <[email protected]>
1 parent 35dea7d commit 72160a3

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/Cody.Core/Common/Configuration.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ namespace Cody.Core.Common
55
{
66
public static partial class Configuration
77
{
8+
public static bool DebugLogs => Get(false);
89

910
public static bool AgentDebug => Get(false);
1011

src/Cody.Core/Logging/Logger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void Info(string message, [CallerMemberName] string callerName = "")
2828

2929
public void Debug(string message, [CallerMemberName] string callerName = "", [CallerFilePath] string callerFilePath = null)
3030
{
31-
if (Configuration.IsDebug)
31+
if (Configuration.DebugLogs)
3232
{
3333
var callerTypeName = Path.GetFileNameWithoutExtension(callerFilePath);
3434
callerName = $"{callerTypeName}.{callerName}";
@@ -43,7 +43,7 @@ public void Debug(string message, [CallerMemberName] string callerName = "", [Ca
4343

4444
public void Debug(string message, Exception ex, [CallerMemberName] string callerName = "", [CallerFilePath] string callerFilePath = null)
4545
{
46-
if (Configuration.IsDebug)
46+
if (Configuration.DebugLogs)
4747
{
4848
Debug(message, callerName, callerFilePath);
4949
Error(message, ex, callerName);

src/CodyDevConfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
22
"AgentDebug": true,
33
"AgentVerboseDebug": true,
4-
"AllowNodeDebug": true,
4+
"AllowNodeDebug": true,
5+
"DebugLogs": true,
56

67
//"AgentDirectory": "C:/dev/cody/agent/dist",
78

0 commit comments

Comments
 (0)