-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from serilog/dev
6.1.0 Release
- Loading branch information
Showing
22 changed files
with
1,041 additions
and
1,079 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<LangVersion>latest</LangVersion> | ||
<TreatWarningsAsErrors>True</TreatWarningsAsErrors> | ||
<SignAssembly>true</SignAssembly> | ||
<AssemblyOriginatorKeyFile>../../assets/Serilog.snk</AssemblyOriginatorKeyFile> | ||
<PublicSign Condition=" '$(OS)' != 'Windows_NT' ">true</PublicSign> | ||
<CheckEolTargetFramework>false</CheckEolTargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
</PropertyGroup> | ||
</Project> |
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,7 +1,7 @@ | ||
{ | ||
"sdk": { | ||
"allowPrerelease": false, | ||
"version": "5.0.201", | ||
"version": "6.0.401", | ||
"rollForward": "latestFeature" | ||
} | ||
} |
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,47 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using System.Diagnostics; | ||
using Microsoft.AspNetCore.Mvc; | ||
using Microsoft.Extensions.Logging; | ||
using Sample.Models; | ||
using Serilog; | ||
|
||
namespace Sample.Controllers | ||
namespace Sample.Controllers; | ||
|
||
public class HomeController : Controller | ||
{ | ||
public class HomeController : Controller | ||
static int _callCount; | ||
|
||
readonly ILogger<HomeController> _logger; | ||
readonly IDiagnosticContext _diagnosticContext; | ||
|
||
public HomeController(ILogger<HomeController> logger, IDiagnosticContext diagnosticContext) | ||
{ | ||
_logger = logger ?? throw new ArgumentNullException(nameof(logger)); | ||
_diagnosticContext = diagnosticContext ?? throw new ArgumentNullException(nameof(diagnosticContext)); | ||
} | ||
|
||
public IActionResult Index() | ||
{ | ||
_logger.LogInformation("Hello, world!"); | ||
|
||
_diagnosticContext.Set("IndexCallCount", Interlocked.Increment(ref _callCount)); | ||
|
||
return View(); | ||
} | ||
|
||
public IActionResult Privacy() | ||
{ | ||
throw new InvalidOperationException("Something went wrong."); | ||
} | ||
|
||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] | ||
public IActionResult Error() | ||
{ | ||
static int _callCount; | ||
|
||
readonly ILogger<HomeController> _logger; | ||
readonly IDiagnosticContext _diagnosticContext; | ||
|
||
public HomeController(ILogger<HomeController> logger, IDiagnosticContext diagnosticContext) | ||
{ | ||
_logger = logger ?? throw new ArgumentNullException(nameof(logger)); | ||
_diagnosticContext = diagnosticContext ?? throw new ArgumentNullException(nameof(diagnosticContext)); | ||
} | ||
|
||
public IActionResult Index() | ||
{ | ||
_logger.LogInformation("Hello, world!"); | ||
|
||
_diagnosticContext.Set("IndexCallCount", Interlocked.Increment(ref _callCount)); | ||
|
||
return View(); | ||
} | ||
|
||
public IActionResult Privacy() | ||
{ | ||
throw new InvalidOperationException("Something went wrong."); | ||
} | ||
|
||
[ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)] | ||
public IActionResult Error() | ||
{ | ||
return View(new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier}); | ||
} | ||
return View(new ErrorViewModel {RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier}); | ||
} | ||
} | ||
} |
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,11 +1,8 @@ | ||
using System; | ||
namespace Sample.Models; | ||
|
||
namespace Sample.Models | ||
public class ErrorViewModel | ||
{ | ||
public class ErrorViewModel | ||
{ | ||
public string RequestId { get; set; } | ||
public string? RequestId { get; set; } | ||
|
||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); | ||
} | ||
public bool ShowRequestId => !string.IsNullOrEmpty(RequestId); | ||
} |
Oops, something went wrong.