plugin: Remove Logging alias and update imports

This commit is contained in:
Lucien Greathouse
2019-10-02 11:10:34 -07:00
parent 3554112f31
commit b562d11994
7 changed files with 23 additions and 26 deletions

View File

@@ -2,11 +2,11 @@ local Rojo = script:FindFirstAncestor("Rojo")
local Plugin = Rojo.Plugin
local Roact = require(Rojo.Roact)
local Log = require(Rojo.Log)
local Assets = require(Plugin.Assets)
local Config = require(Plugin.Config)
local DevSettings = require(Plugin.DevSettings)
local Logging = require(Plugin.Logging)
local Session = require(Plugin.Session)
local Version = require(Plugin.Version)
local preloadAssets = require(Plugin.preloadAssets)
@@ -26,7 +26,7 @@ local function showUpgradeMessage(lastVersion)
Version.display(Config.version), Config.expectedServerVersionString
)
Logging.info(message)
Log.info(message)
end
--[[
@@ -114,7 +114,7 @@ function App:render()
children = {
ConnectionActivePanel = e(ConnectionActivePanel, {
stopSession = function()
Logging.trace("Disconnecting session")
Log.trace("Disconnecting session")
self.currentSession:disconnect()
self.currentSession = nil
@@ -122,7 +122,7 @@ function App:render()
sessionStatus = SessionStatus.Disconnected,
})
Logging.trace("Session terminated by user")
Log.trace("Session terminated by user")
end,
}),
}
@@ -130,13 +130,13 @@ function App:render()
children = {
ConnectPanel = e(ConnectPanel, {
startSession = function(address, port)
Logging.trace("Starting new session")
Log.trace("Starting new session")
local success, session = Session.new({
address = address,
port = port,
onError = function(message)
Logging.warn("Rojo session terminated because of an error:\n%s", tostring(message))
Log.warn("Rojo session terminated because of an error:\n%s", tostring(message))
self.currentSession = nil
self:setState({
@@ -153,7 +153,7 @@ function App:render()
end
end,
cancel = function()
Logging.trace("Canceling session configuration")
Log.trace("Canceling session configuration")
self:setState({
sessionStatus = SessionStatus.Disconnected,
@@ -169,7 +169,7 @@ function App:render()
end
function App:didMount()
Logging.trace("Rojo %s initializing", self.displayedVersion)
Log.trace("Rojo %s initializing", self.displayedVersion)
checkUpgrade(self.props.plugin)
preloadAssets()

View File

@@ -1,4 +1,4 @@
local Logging = require(script.Parent.Logging)
local Log = require(script.Parent.Parent.Log)
--[[
A bidirectional map between instance IDs and Roblox instances. It lets us
@@ -30,7 +30,7 @@ function InstanceMap:removeId(id)
self.fromIds[id] = nil
self.fromInstances[instance] = nil
else
Logging.warn("Attempted to remove nonexistant ID %s", tostring(id))
Log.warn("Attempted to remove nonexistant ID %s", tostring(id))
end
end
@@ -41,7 +41,7 @@ function InstanceMap:removeInstance(instance)
self.fromInstances[instance] = nil
self.fromIds[id] = nil
else
Logging.warn("Attempted to remove nonexistant instance %s", tostring(instance))
Log.warn("Attempted to remove nonexistant instance %s", tostring(instance))
end
end
@@ -51,7 +51,7 @@ function InstanceMap:destroyInstance(instance)
if id ~= nil then
self:destroyId(id)
else
Logging.warn("Attempted to destroy untracked instance %s", tostring(instance))
Log.warn("Attempted to destroy untracked instance %s", tostring(instance))
end
end
@@ -74,7 +74,7 @@ function InstanceMap:destroyId(id)
instance:Destroy()
else
Logging.warn("Attempted to destroy nonexistant ID %s", tostring(id))
Log.warn("Attempted to destroy nonexistant ID %s", tostring(id))
end
end

View File

@@ -1,2 +0,0 @@
-- TODO: Remove this once all references have been updated.
return require(script.Parent.Parent.Log)

View File

@@ -1,7 +1,7 @@
local t = require(script.Parent.Parent.t)
local Log = require(script.Parent.Parent.Log)
local InstanceMap = require(script.Parent.InstanceMap)
local Logging = require(script.Parent.Logging)
local setCanonicalProperty = require(script.Parent.setCanonicalProperty)
local rojoValueToRobloxValue = require(script.Parent.rojoValueToRobloxValue)
local Types = require(script.Parent.Types)
@@ -50,7 +50,7 @@ function Reconciler:reconcile(virtualInstancesById, id, instance)
-- If an instance changes ClassName, we assume it's very different. That's
-- not always the case!
if virtualInstance.ClassName ~= instance.ClassName then
Logging.trace("Switching to reify for %s because ClassName is different", instance:GetFullName())
Log.trace("Switching to reify for %s because ClassName is different", instance:GetFullName())
-- TODO: Preserve existing children instead?
local parent = instance.Parent
@@ -95,7 +95,7 @@ function Reconciler:reconcile(virtualInstancesById, id, instance)
unvisitedExistingChildren[existingChildInstance] = nil
self:reconcile(virtualInstancesById, childId, existingChildInstance)
else
Logging.trace(
Log.trace(
"Switching to reify for %s.%s because it does not exist",
instance:GetFullName(),
virtualInstancesById[childId].Name
@@ -125,7 +125,7 @@ function Reconciler:reconcile(virtualInstancesById, id, instance)
local parent = self.instanceMap.fromIds[virtualInstance.Parent]
if parent == nil then
Logging.info("Instance %s wanted parent of %s", tostring(id), tostring(virtualInstance.Parent))
Log.info("Instance %s wanted parent of %s", tostring(id), tostring(virtualInstance.Parent))
error("Rojo bug: During reconciliation, an instance referred to an instance ID as parent that does not exist.")
end
@@ -232,7 +232,7 @@ function Reconciler:__applyUpdatePiece(id, visitedIds, virtualInstancesById)
return
end
Logging.trace("Instance ID %s, parent ID %s", tostring(id), tostring(virtualInstance.Parent))
Log.trace("Instance ID %s, parent ID %s", tostring(id), tostring(virtualInstance.Parent))
error("Rojo NYI: Instances with parents that weren't mentioned in an update payload")
end

View File

@@ -1,6 +1,4 @@
local Rojo = script:FindFirstAncestor("Rojo")
local Promise = require(Rojo.Promise)
local Promise = require(script.Parent.Parent.Promise)
local ApiContext = require(script.Parent.ApiContext)
local Reconciler = require(script.Parent.Reconciler)

View File

@@ -1,6 +1,7 @@
local ContentProvider = game:GetService("ContentProvider")
local Logging = require(script.Parent.Logging)
local Log = require(script.Parent.Parent.Log)
local Assets = require(script.Parent.Assets)
local function preloadAssets()
@@ -18,7 +19,7 @@ local function preloadAssets()
table.insert(contentUrls, url)
end
Logging.trace("Preloading assets: %s", table.concat(contentUrls, ", "))
Log.trace("Preloading assets: %s", table.concat(contentUrls, ", "))
coroutine.wrap(function()
ContentProvider:PreloadAsync(contentUrls)

View File

@@ -1,4 +1,4 @@
local RbxDom = require(script:FindFirstAncestor("Rojo").RbxDom)
local RbxDom = require(script.Parent.Parent.RbxDom)
--[[
Attempts to set a property on the given instance.