Skip to content

Commit 41027f3

Browse files
Added Timestamp to Log (#688)
* When plugin defines an empty array of URLs to watch, use the global one #527 * Refactor plugin registration on line 55 to check for both null and non-empty 'pluginUrls'. This ensures proper handling of empty plugin URL arrays and aligns with the requirement outlined in the issue. Updated the 'Register' method call to conditionally use 'pluginUrls' or default to 'defaultUrlsToWatch' based on the not null and not empty check. #528 * Fix handling of empty 'urlsToWatch' in plugins This commit addresses the issue where plugins defining an empty array for 'urlsToWatch' would result in the plugin being disabled. The code has been modified to check for both null and empty arrays, and in both cases, it now defaults to using the global list of URLs. This ensures that plugins remain active even when no specific URLs are provided. * Update dev-proxy/PluginLoader.cs * GitHub actions * Update Dependencies * timestamp * Update ConsoleLogger.cs * Update ConsoleLogger.cs --------- Co-authored-by: Waldek Mastykarz <[email protected]>
1 parent 566d897 commit 41027f3

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

dev-proxy-plugins/RequestLogs/ApiCenterProductionVersionPlugin.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,9 @@ public override void Register(IPluginEvents pluginEvents,
123123
{
124124
InnerHandler = new HttpClientHandler()
125125
};
126-
127-
_logger?.LogDebug("[{now}] Plugin {plugin} checking Azure auth...", DateTime.Now, Name);
126+
127+
_logger?.LogDebug("Plugin {plugin} checking Azure auth...", Name);
128+
128129
try
129130
{
130131
_ = authenticationHandler.GetAccessToken(CancellationToken.None).Result;
@@ -138,7 +139,7 @@ public override void Register(IPluginEvents pluginEvents,
138139
_logger?.LogError(ex, "Failed to authenticate with Azure. The {plugin} will not be used.", Name);
139140
return;
140141
}
141-
_logger?.LogDebug("[{now}] Plugin {plugin} auth confirmed...", DateTime.Now, Name);
142+
_logger?.LogDebug("Plugin {plugin} auth confirmed...", Name);
142143

143144
_httpClient = new HttpClient(authenticationHandler);
144145

dev-proxy/ConsoleLogger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ private void WriteError(string message)
5454
private void WriteDebug(string message)
5555
{
5656
Console.ForegroundColor = ConsoleColor.Gray;
57-
Console.Error.WriteLine(message);
57+
Console.Error.WriteLine($"[{DateTime.Now}] {message}");
5858
Console.ForegroundColor = _color;
5959
}
6060

@@ -377,4 +377,4 @@ public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Except
377377

378378
/// <inheritdoc/>
379379
public IDisposable? BeginScope<TState>(TState state) where TState : notnull => default!;
380-
}
380+
}

0 commit comments

Comments
 (0)