setLogSilent
Determines if debugging functions such as
ac.log(), ac.warn(), and ac.error() should write their output to the physical log file on your drive.
Usage Patterns
Section titled “Usage Patterns”Calling the function without an argument or with true stops disk writing.
ac.setLogSilent(true)Passing false restores default behavior, writing all log entries to the drive.
ac.setLogSilent(false)Description
Section titled “Description”The ac.setLogSilent function is a performance and hardware safety utility.
Writing to a physical file on an SSD or HDD is a relatively slow operation compared to updating a UI element.
When you are debugging complex logic that prints multiple messages every frame,
the overhead of disk I/O has potential to cause noticeable stuttering or “lag” in the simulation.
By silencing the log, you can continue to use high-frequency logging for development while ensuring the simulation remains smooth. This also helps prevent unnecessary wear on storage hardware during long development sessions.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
value | boolean | No | true | Whether logging to the disk should be silenced. |
Examples
Section titled “Examples”Silencing the log to safely monitor a variable that changes every frame.
-- stop writing to the physical file to save performanceac.setLogSilent(true)
function script.update() local car = ac.getCar(0) -- this would normally spam the drive, but is now safe ac.log("Current Speed:", car.speedKmh)endEnsuring logs are only written to disk when a specific error state is met.
-- start silencedac.setLogSilent(true)
function checkSystem(status) if status == "CRITICAL" then -- re-enable disk logging so the error is saved for later review ac.setLogSilent(false) ac.error("Critical system failure detected!") endend