1
0
mirror of https://github.com/bitwarden/server.git synced 2024-12-24 17:17:40 +01:00

cleanup logs

This commit is contained in:
Kyle Spearrin 2018-03-23 13:39:34 -04:00
parent 702d833cea
commit 13db0285c9
3 changed files with 9 additions and 8 deletions

View File

@ -62,7 +62,7 @@ namespace Bit.Admin
GlobalSettings globalSettings, GlobalSettings globalSettings,
ILoggerFactory loggerFactory) ILoggerFactory loggerFactory)
{ {
loggerFactory.AddSerilog(env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error); loggerFactory.AddSerilog(app, env, appLifetime, globalSettings, (e) => e.Level >= LogEventLevel.Error);
if(env.IsDevelopment()) if(env.IsDevelopment())
{ {

View File

@ -69,10 +69,10 @@
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" /> <PackageReference Include="Serilog.Extensions.Logging" Version="2.0.2" />
<PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" /> <PackageReference Include="Serilog.Extensions.Logging.File" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.AzureDocumentDB" Version="3.8.0" /> <PackageReference Include="Serilog.Sinks.AzureDocumentDB" Version="3.8.0" />
<PackageReference Include="Serilog.Sinks.Sentry.AspNetCore" Version="2.1.4" />
<PackageReference Include="IdentityServer4" Version="2.1.2" /> <PackageReference Include="IdentityServer4" Version="2.1.2" />
<PackageReference Include="Dapper" Version="1.50.4" /> <PackageReference Include="Dapper" Version="1.50.4" />
<PackageReference Include="Newtonsoft.Json" Version="11.0.1" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.1" />
<PackageReference Include="Serilog.Sinks.Sentry.AspNetCore" Version="2.1.4" />
<PackageReference Include="WindowsAzure.Storage" Version="9.0.0" /> <PackageReference Include="WindowsAzure.Storage" Version="9.0.0" />
<PackageReference Include="AspNetCoreRateLimit" Version="2.1.0" /> <PackageReference Include="AspNetCoreRateLimit" Version="2.1.0" />
<PackageReference Include="Braintree" Version="3.12.0" /> <PackageReference Include="Braintree" Version="3.12.0" />

View File

@ -28,13 +28,13 @@ namespace Bit.Core.Utilities
.Enrich.FromLogContext() .Enrich.FromLogContext()
.Filter.ByIncludingOnly(filter); .Filter.ByIncludingOnly(filter);
if(globalSettings.DocumentDb != null && CoreHelpers.SettingHasValue(globalSettings.DocumentDb.Uri) && if(CoreHelpers.SettingHasValue(globalSettings?.DocumentDb.Uri) &&
CoreHelpers.SettingHasValue(globalSettings.DocumentDb.Key)) CoreHelpers.SettingHasValue(globalSettings?.DocumentDb.Key))
{ {
config.WriteTo.AzureDocumentDB(new Uri(globalSettings.DocumentDb.Uri), globalSettings.DocumentDb.Key, config.WriteTo.AzureDocumentDB(new Uri(globalSettings.DocumentDb.Uri),
timeToLive: TimeSpan.FromDays(7)); globalSettings.DocumentDb.Key, timeToLive: TimeSpan.FromDays(7));
} }
else if(globalSettings.Sentry != null && CoreHelpers.SettingHasValue(globalSettings.Sentry.Dsn)) else if(CoreHelpers.SettingHasValue(globalSettings?.Sentry.Dsn))
{ {
config.WriteTo.Sentry(globalSettings.Sentry.Dsn) config.WriteTo.Sentry(globalSettings.Sentry.Dsn)
.Enrich.FromLogContext() .Enrich.FromLogContext()
@ -46,7 +46,8 @@ namespace Bit.Core.Utilities
} }
else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory)) else if(CoreHelpers.SettingHasValue(globalSettings.LogDirectory))
{ {
config.WriteTo.RollingFile($"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt"); config.WriteTo.RollingFile(
$"{globalSettings.LogDirectory}/{globalSettings.ProjectName}/{{Date}}.txt");
} }
var serilog = config.CreateLogger(); var serilog = config.CreateLogger();