Files
server/src/Notifications/Program.cs

50 lines
1.7 KiB
C#
Raw Normal View History

2018-08-02 12:14:33 -04:00
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
2019-07-23 16:38:49 -04:00
using Bit.Core.Utilities;
using Serilog.Events;
2018-08-02 12:14:33 -04:00
2018-08-16 13:45:31 -04:00
namespace Bit.Notifications
2018-08-02 12:14:33 -04:00
{
public class Program
{
public static void Main(string[] args)
{
WebHost
.CreateDefaultBuilder(args)
.UseStartup<Startup>()
2019-07-23 16:38:49 -04:00
.ConfigureLogging((hostingContext, logging) =>
logging.AddSerilog(hostingContext, e =>
{
var context = e.Properties["SourceContext"].ToString();
if(context.Contains("IdentityServer4.Validation.TokenValidator") ||
context.Contains("IdentityServer4.Validation.TokenRequestValidator"))
{
return e.Level > LogEventLevel.Error;
}
2019-08-31 08:22:30 -04:00
if(e.Level == LogEventLevel.Error &&
e.MessageTemplate.Text == "Failed connection handshake.")
2019-07-23 16:38:49 -04:00
{
return false;
}
2019-08-31 08:22:30 -04:00
if(e.Level == LogEventLevel.Error &&
e.MessageTemplate.Text.StartsWith("Failed writing message."))
{
return false;
}
if(e.Level == LogEventLevel.Warning &&
e.MessageTemplate.Text.StartsWith("Heartbeat took longer"))
2019-07-23 16:38:49 -04:00
{
return false;
}
return e.Level >= LogEventLevel.Warning;
}))
2018-08-02 12:14:33 -04:00
.Build()
.Run();
}
}
}