diff --git a/v3/pkg/application/application.go b/v3/pkg/application/application.go index 65b33d5bca9..7215accb90f 100644 --- a/v3/pkg/application/application.go +++ b/v3/pkg/application/application.go @@ -74,7 +74,12 @@ func New(appOptions Options) *App { Middleware: assetserver.Middleware(appOptions.Assets.Middleware), } - srv, err := assetserver.NewAssetServer(opts, false, result.Logger, wailsruntime.RuntimeAssetsBundle, result.isDebugMode, NewMessageProcessor(result.Logger)) + assetLogger := result.Logger + if appOptions.Assets.DisableLogging { + assetLogger = slog.New(slog.NewTextHandler(io.Discard, nil)) + } + + srv, err := assetserver.NewAssetServer(opts, false, assetLogger, wailsruntime.RuntimeAssetsBundle, result.isDebugMode, NewMessageProcessor(result.Logger)) if err != nil { result.Logger.Error("Fatal error in application initialisation: " + err.Error()) os.Exit(1) diff --git a/v3/pkg/application/options_application.go b/v3/pkg/application/options_application.go index ad5db123d6d..5ee2afe35ab 100644 --- a/v3/pkg/application/options_application.go +++ b/v3/pkg/application/options_application.go @@ -80,6 +80,9 @@ type AssetOptions struct { // Multiple Middlewares can be chained together with: // ChainMiddleware(middleware ...Middleware) Middleware Middleware Middleware + + // DisableLogging disables logging of the AssetServer. By default, the AssetServer logs every request. + DisableLogging bool } // Middleware defines HTTP middleware that can be applied to the AssetServer.