mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
Do not await log flushes when writing
look at that it solved my whole ass problem
This commit is contained in:
parent
b8e62cc683
commit
6ed6edd762
@ -1,10 +1,6 @@
|
|||||||
namespace Bloxstrap
|
namespace Bloxstrap
|
||||||
{
|
{
|
||||||
// https://stackoverflow.com/a/53873141/11852173
|
// https://stackoverflow.com/a/53873141/11852173
|
||||||
// TODO - this kind of sucks
|
|
||||||
// the main problem is just that this doesn't finish writing log entries before exiting the program
|
|
||||||
// this can be solved by making writetolog completely synchronous, but while it doesn't affect performance, its's not ideal
|
|
||||||
// also, writing and flushing for every single line that's written may not be great
|
|
||||||
|
|
||||||
public class Logger
|
public class Logger
|
||||||
{
|
{
|
||||||
@ -97,7 +93,8 @@
|
|||||||
{
|
{
|
||||||
await _semaphore.WaitAsync();
|
await _semaphore.WaitAsync();
|
||||||
await _filestream!.WriteAsync(Encoding.UTF8.GetBytes($"{message}\r\n"));
|
await _filestream!.WriteAsync(Encoding.UTF8.GetBytes($"{message}\r\n"));
|
||||||
await _filestream.FlushAsync();
|
|
||||||
|
_ = _filestream.FlushAsync();
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user