Enhance logging for syncback operations and patch applications

- Added detailed logging for syncback operations, including additions, removals, and updates, to improve traceability and debugging.
- Implemented summary logs for patch applications in both the client and server, capturing the number of changes made.
- Enhanced logging in the ChangeBatcher and ApiService to provide insights into property changes and instance updates during syncback processes.
- Improved error handling and logging for VFS events to ensure better visibility of file operations.
This commit is contained in:
Joe 2026-01-31 12:06:27 -06:00
parent d3d914e660
commit 6dc8f219bd
7 changed files with 242 additions and 6 deletions

View file

@ -173,6 +173,11 @@ encodeInstance = function(instance, parentId, _skipPathCheck)
return nil
end
-- Log encoding at trace level (very detailed)
if not _skipPathCheck then
Log.trace("Encoding for syncback: {} ({})", instance:GetFullName(), instance.ClassName)
end
local properties = {}
-- Always try to encode Attributes and Tags for any instance type
@ -262,6 +267,18 @@ encodeInstance = function(instance, parentId, _skipPathCheck)
end
end
-- Log property count for debugging
local propCount = 0
for _ in pairs(properties) do
propCount += 1
end
Log.trace(
" Encoded {} with {} properties, {} children",
instance.Name,
propCount,
#children
)
return {
parent = parentId,
name = instance.Name,

View file

@ -5,6 +5,9 @@
local RunService = game:GetService("RunService")
local Packages = script.Parent.Parent.Packages
local Log = require(Packages.Log)
local PatchSet = require(script.Parent.PatchSet)
local createPatchSet = require(script.createPatchSet)
@ -64,8 +67,10 @@ function ChangeBatcher:add(instance, propertyName)
if not properties then
properties = {}
self.__pendingPropertyChanges[instance] = properties
Log.trace("ChangeBatcher: tracking changes to {}", instance:GetFullName())
end
Log.trace("ChangeBatcher: property '{}' changed on {}", propertyName, instance:GetFullName())
properties[propertyName] = true
end
@ -96,11 +101,24 @@ function ChangeBatcher:__flush()
end
local patch = createPatchSet(self.__instanceMap, self.__pendingPropertyChanges, self.__syncSourceOnly)
self.__pendingPropertyChanges = {}
if PatchSet.isEmpty(patch) then
return nil
end
-- Log summary at debug level
local addedCount = 0
for _ in pairs(patch.added) do
addedCount += 1
end
Log.debug(
"Two-way sync: {} updates, {} additions, {} removals",
#patch.updated,
addedCount,
#patch.removed
)
return patch
end