mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-08 13:40:02 +08:00
Added option to disable AssetServer logging.
An option to disable AssetServer logging has been introduced in the application options. This will suppress every request log from the AssetServer if set to true. This adjustment is useful for preventing log saturation in certain scenarios or environments.
This commit is contained in:
parent
68b12d4fff
commit
6c3bd124ce
@ -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)
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user