Skip to content

Commit 224f874

Browse files
Szercursoragent
andauthored
Reduce log noise: suppress ASP.NET/HttpClient info logs, render messages, silence ChatMember updates (#111)
- Override MinimumLevel to Warning for Microsoft.AspNetCore and System.Net.Http.HttpClient (incoming/outgoing HTTP request lifecycle logs are redundant with OTEL traces) - Switch CompactJsonFormatter to RenderedCompactJsonFormatter so logs contain readable @m instead of raw @mt template - Handle ChatMember/MyChatMember updates silently instead of logging a warning Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent dbd1940 commit 224f874

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/VahterBanBot/Bot.fs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,6 +1233,9 @@ let onUpdate
12331233
elif update.EditedOrMessage <> null then
12341234
do! tryEnrichMessageWithOcr botClient botConfig computerVision logger update
12351235
do! onMessage botUser botClient botConfig logger ml update.EditedOrMessage
1236+
elif update.ChatMember <> null || update.MyChatMember <> null then
1237+
// expected update type, nothing to do
1238+
()
12361239
else
12371240
// unknown update type, just log and ignore
12381241
logger.LogWarning("Unknown update type: {UpdateType}", update.Type)

src/VahterBanBot/Program.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,9 +116,11 @@ let builder = WebApplication.CreateBuilder()
116116
%builder.Host.UseSerilog(fun context services configuration ->
117117
%configuration
118118
.ReadFrom.Configuration(context.Configuration)
119+
.MinimumLevel.Override("Microsoft.AspNetCore", Serilog.Events.LogEventLevel.Warning)
120+
.MinimumLevel.Override("System.Net.Http.HttpClient", Serilog.Events.LogEventLevel.Warning)
119121
.Enrich.FromLogContext()
120122
.Enrich.WithSpan()
121-
.WriteTo.Console(CompactJsonFormatter())
123+
.WriteTo.Console(RenderedCompactJsonFormatter())
122124
)
123125

124126
%builder.Services

0 commit comments

Comments
 (0)