[backend/drive] Improve VIPS logger

This commit is contained in:
Laura Hausmann 2024-05-01 01:57:01 +02:00
parent eab5e02b70
commit 7af0c6f1a7
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -197,15 +197,14 @@ public static class WebApplicationExtensions
SixLabors.ImageSharp.Configuration.Default.MemoryAllocator =
MemoryAllocator.Create(new MemoryAllocatorOptions { AllocationLimitMegabytes = 20 });
NetVips.Log.SetLogHandler("VIPS", NetVips.Enums.LogLevelFlags.Warning, null);
NetVips.Log.SetLogHandler("VIPS", NetVips.Enums.LogLevelFlags.Error, (domain, _, message) =>
{
app.Logger.LogWarning("libvips error: {domain} - {message}", domain, message);
});
app.Logger.LogInformation("Initializing application, please wait...");
var logger = app.Services.GetRequiredService<ILogger<DriveService>>();
NetVips.Log.SetLogHandler("VIPS", NetVips.Enums.LogLevelFlags.Warning | NetVips.Enums.LogLevelFlags.Error,
VipsLogDelegate);
return instanceConfig;
void VipsLogDelegate(string domain, NetVips.Enums.LogLevelFlags _, string message) =>
logger.LogWarning("libvips: {domain} - {message}", domain, message);
}
public static void SetKestrelUnixSocketPermissions(this WebApplication app)