-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ea070bc
commit 7063816
Showing
7 changed files
with
35 additions
and
8 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,23 @@ | ||
using CoreDocker.Core.Framework.Logging; | ||
using Serilog.Events; | ||
using Path = System.IO.Path; | ||
|
||
namespace CoreDocker.Api; | ||
|
||
public static class Logging | ||
{ | ||
public static void AddSerilog(this WebApplicationBuilder builder) | ||
{ | ||
Log.Logger = LoggingHelper.SetupOnce(() => new LoggerConfiguration() | ||
.MinimumLevel.Information() | ||
.MinimumLevel.Override("Microsoft", LogEventLevel.Warning) | ||
.Enrich.FromLogContext() | ||
.WriteTo.Console(outputTemplate: "[{Timestamp:HH:mm:ss} {Level:u3}] {Message:lj}{NewLine}{Exception}") | ||
.WriteTo.File(Path.Combine(Path.GetTempPath(), "logs", "CoreDocker.Api.log"), | ||
fileSizeLimitBytes: 10 * LoggingHelper.MB, | ||
rollOnFileSizeLimit: true) | ||
.CreateLogger()); | ||
builder.Logging.ClearProviders(); | ||
builder.Logging.AddSerilog(Log.Logger); | ||
} | ||
} |
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
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 |
---|---|---|
|
@@ -25,5 +25,6 @@ public static ILogger SetupOnce(Func<ILogger> func) | |
|
||
return Log.Logger; | ||
} | ||
|
||
} | ||
} |
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