Jump to content

suppress warnings/errors


Bonsai

Recommended Posts

Hey Peeps,

is there are way to suppress warnings and errors, so they don't show up in the debuglog?

I have a resource that is producing a lot of errors, but those errors are not important and not fixable (map scripts).

But they are spamming my debuglog too much so actual problems might be missed.

Is there something like that?

Bonsai

Link to comment

The only thing you can do to effectively hide errors and warnings which originate from scripting errors is making your own debug view, hiding the default one and control which messages do you want to be output to the new debug view by using the onClientDebugMessage event.

However, if that warnings and errors are caused by explicit calls to the outputDebugString function, you can disable that function (providing that scripts don't call it in a hacky manner, or overload it with another name) by using addDebugHook:

local targetResource = getResourceFromName("resource-name") 
  
local function disableDebugOutput(sourceResource) 
    if sourceResource == targetResource then 
        -- Don't call the actual function if the call is from the resource we want to block 
        return "skip" 
    end 
    -- Otherwise, continue normally 
end 
addDebugHook("preFunction", disableDebugOutput, { "outputDebugString" }) 

Keep in mind that addDebugHook and any other approaches to hide that warnings are not designed with performance and retail use in mind, so it is not a good practice to just hide the errors in the script. Fixing the errors which cause the debug spam is the thing that should be done instead.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...