-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More Multi-threading, logging and finished the bullets
- Loading branch information
Leonard Sperry
committed
Dec 20, 2020
1 parent
edcfb70
commit b893797
Showing
4 changed files
with
85 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,45 @@ | ||
using System; | ||
using Microsoft.Extensions.Logging; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Samples | ||
{ | ||
class Misc | ||
{ | ||
|
||
ILogger _logger = null; | ||
void Asdf() | ||
{ | ||
List<int> ints = new List<int>(); | ||
using (_logger.BeginScope("add context here")) | ||
{ | ||
CallAnotherMethod(); | ||
} | ||
} | ||
|
||
private void CallAnotherMethod() | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public void TopLevelMethod() | ||
{ | ||
try | ||
{ | ||
using (_logger.BeginScope("add context here")) | ||
{ | ||
CallAnotherMethod(); | ||
} | ||
} | ||
catch (Exception ex) when (HandleException(ex, true)) | ||
{ | ||
} | ||
} | ||
|
||
public bool HandleException(Exception ex, bool propogate = false) | ||
{ | ||
_logger.LogError(ex, "unhandled error"); | ||
return propogate; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters