Log Spam Filter

Log Spam Filter

494 Downloads
The SMAPI log is great, but if you don't pay attention it can spam the same error or log messages each frame, needlessly filling up space, writing to disk, and even slowing down your game.

This mod tries to fix that a bit, by catching messages that fit custom parameters and throttling them for a specific period of time.

It has the following configurable options:


    EnableMod - enable the mod
    IsDebug - post SMAPI log messages every time throttling occurs (default: false)

    AllowList - always allow from specific sources (usually the name of a mod, the last part of a SMAPI log line before the ]), comma-separated

    MSSpawnThrottle - time in milliseconds to throttle a source after catching spam (default: 1000)

    MSBetweenMessages - throttle a source if it posts messages more frequently than this many milliseconds (default: 0)
    MSBetweenIdenticalMessages - throttle a source if it posts identical messages more frequently than this many milliseconds (default: 0)
    MSBetweenSimilarMessages - throttle a source if it posts similar messages more frequently than this many milliseconds (default: 0)
    PercentSimilarity - percent similarity two consecutive messages must be to consider them similar (default: 0)


Similarity is pretty rudimentary, don't expect deep checking. I don't recommend turning on similar or all message throttling unless you are a mod dev and/or don't really care about providing complete SMAPI logs.

All of the config variables except for AllowList can be configured using GMCM. You can edit the mod's config.json file to modify AllowList.

There is a tally of how many messages have been throttled in the GMCM interface.


Technical

Requires SMAPI, uses Harmony.

Compatible with Mod Updater for automatic updates.

Code is at https://github.com/aedenthorn/StardewValleyMods.

If you want to complain or ask for help or help me test my mods, you can visit my Discord server.

A list of all my mods for Stardew Valley is available at https://www.nexusmods.com/stardewvalley/articles/895.