Skip to content

Commit

Permalink
Show hotkeys log on proxy start and after clear screen (#592)
Browse files Browse the repository at this point in the history
* Show hotkeys log on proxy start and after clear screen. Extract common method for hotkeys logging

* Use Console output to show messages in terminal if logger will be different in future

* Update ProxyEngine.cs

* Update ProxyEngine.cs

---------

Co-authored-by: Waldek Mastykarz <[email protected]>
  • Loading branch information
oleguchok and waldekmastykarz authored Mar 11, 2024
1 parent 2d5d996 commit e6c7956
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dev-proxy/ProxyEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public async Task Run(CancellationToken? cancellationToken)
_logger.LogInformation("Configure your application to use this proxy's port and address");
}

_logger.LogInformation("Press CTRL+C to stop Dev Proxy\r\n");
PrintHotkeys();
Console.CancelKeyPress += Console_CancelKeyPress;

if (_config.Record)
Expand Down Expand Up @@ -237,8 +237,7 @@ private void ReadKeys()
if (key == ConsoleKey.C)
{
Console.Clear();
Console.WriteLine("Press CTRL+C to stop Dev Proxy");
Console.WriteLine("");
PrintHotkeys();
}
if (key == ConsoleKey.W)
{
Expand Down Expand Up @@ -590,4 +589,11 @@ Task OnCertificateSelection(object sender, CertificateSelectionEventArgs e)
// set e.clientCertificate to override
return Task.CompletedTask;
}

private void PrintHotkeys()
{
Console.WriteLine("Hotkeys: (r)ecord, (s)top recording, (c)lear screen");
Console.WriteLine("Press CTRL+C to stop Dev Proxy");
Console.WriteLine("");
}
}

0 comments on commit e6c7956

Please sign in to comment.