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 Plugin = Rojo.Plugin
local Roact = require(Rojo.Roact) local Roact = require(Rojo.Roact)
local Log = require(Rojo.Log)
local Assets = require(Plugin.Assets) local Assets = require(Plugin.Assets)
local Config = require(Plugin.Config) local Config = require(Plugin.Config)
local DevSettings = require(Plugin.DevSettings) local DevSettings = require(Plugin.DevSettings)
local Logging = require(Plugin.Logging)
local Session = require(Plugin.Session) local Session = require(Plugin.Session)
local Version = require(Plugin.Version) local Version = require(Plugin.Version)
local preloadAssets = require(Plugin.preloadAssets) local preloadAssets = require(Plugin.preloadAssets)
@@ -26,7 +26,7 @@ local function showUpgradeMessage(lastVersion)
Version.display(Config.version), Config.expectedServerVersionString Version.display(Config.version), Config.expectedServerVersionString
) )
Logging.info(message) Log.info(message)
end end
--[[ --[[
@@ -114,7 +114,7 @@ function App:render()
children = { children = {
ConnectionActivePanel = e(ConnectionActivePanel, { ConnectionActivePanel = e(ConnectionActivePanel, {
stopSession = function() stopSession = function()
Logging.trace("Disconnecting session") Log.trace("Disconnecting session")
self.currentSession:disconnect() self.currentSession:disconnect()
self.currentSession = nil self.currentSession = nil
@@ -122,7 +122,7 @@ function App:render()
sessionStatus = SessionStatus.Disconnected, sessionStatus = SessionStatus.Disconnected,
}) })
Logging.trace("Session terminated by user") Log.trace("Session terminated by user")
end, end,
}), }),
} }
@@ -130,13 +130,13 @@ function App:render()
children = { children = {
ConnectPanel = e(ConnectPanel, { ConnectPanel = e(ConnectPanel, {
startSession = function(address, port) startSession = function(address, port)
Logging.trace("Starting new session") Log.trace("Starting new session")
local success, session = Session.new({ local success, session = Session.new({
address = address, address = address,
port = port, port = port,
onError = function(message) 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.currentSession = nil
self:setState({ self:setState({
@@ -153,7 +153,7 @@ function App:render()
end end
end, end,
cancel = function() cancel = function()
Logging.trace("Canceling session configuration") Log.trace("Canceling session configuration")
self:setState({ self:setState({
sessionStatus = SessionStatus.Disconnected, sessionStatus = SessionStatus.Disconnected,
@@ -169,7 +169,7 @@ function App:render()
end end
function App:didMount() function App:didMount()
Logging.trace("Rojo %s initializing", self.displayedVersion) Log.trace("Rojo %s initializing", self.displayedVersion)
checkUpgrade(self.props.plugin) checkUpgrade(self.props.plugin)
preloadAssets() 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 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.fromIds[id] = nil
self.fromInstances[instance] = nil self.fromInstances[instance] = nil
else else
Logging.warn("Attempted to remove nonexistant ID %s", tostring(id)) Log.warn("Attempted to remove nonexistant ID %s", tostring(id))
end end
end end
@@ -41,7 +41,7 @@ function InstanceMap:removeInstance(instance)
self.fromInstances[instance] = nil self.fromInstances[instance] = nil
self.fromIds[id] = nil self.fromIds[id] = nil
else else
Logging.warn("Attempted to remove nonexistant instance %s", tostring(instance)) Log.warn("Attempted to remove nonexistant instance %s", tostring(instance))
end end
end end
@@ -51,7 +51,7 @@ function InstanceMap:destroyInstance(instance)
if id ~= nil then if id ~= nil then
self:destroyId(id) self:destroyId(id)
else else
Logging.warn("Attempted to destroy untracked instance %s", tostring(instance)) Log.warn("Attempted to destroy untracked instance %s", tostring(instance))
end end
end end
@@ -74,7 +74,7 @@ function InstanceMap:destroyId(id)
instance:Destroy() instance:Destroy()
else else
Logging.warn("Attempted to destroy nonexistant ID %s", tostring(id)) Log.warn("Attempted to destroy nonexistant ID %s", tostring(id))
end end
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 t = require(script.Parent.Parent.t)
local Log = require(script.Parent.Parent.Log)
local InstanceMap = require(script.Parent.InstanceMap) local InstanceMap = require(script.Parent.InstanceMap)
local Logging = require(script.Parent.Logging)
local setCanonicalProperty = require(script.Parent.setCanonicalProperty) local setCanonicalProperty = require(script.Parent.setCanonicalProperty)
local rojoValueToRobloxValue = require(script.Parent.rojoValueToRobloxValue) local rojoValueToRobloxValue = require(script.Parent.rojoValueToRobloxValue)
local Types = require(script.Parent.Types) 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 -- If an instance changes ClassName, we assume it's very different. That's
-- not always the case! -- not always the case!
if virtualInstance.ClassName ~= instance.ClassName then 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? -- TODO: Preserve existing children instead?
local parent = instance.Parent local parent = instance.Parent
@@ -95,7 +95,7 @@ function Reconciler:reconcile(virtualInstancesById, id, instance)
unvisitedExistingChildren[existingChildInstance] = nil unvisitedExistingChildren[existingChildInstance] = nil
self:reconcile(virtualInstancesById, childId, existingChildInstance) self:reconcile(virtualInstancesById, childId, existingChildInstance)
else else
Logging.trace( Log.trace(
"Switching to reify for %s.%s because it does not exist", "Switching to reify for %s.%s because it does not exist",
instance:GetFullName(), instance:GetFullName(),
virtualInstancesById[childId].Name virtualInstancesById[childId].Name
@@ -125,7 +125,7 @@ function Reconciler:reconcile(virtualInstancesById, id, instance)
local parent = self.instanceMap.fromIds[virtualInstance.Parent] local parent = self.instanceMap.fromIds[virtualInstance.Parent]
if parent == nil then 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.") error("Rojo bug: During reconciliation, an instance referred to an instance ID as parent that does not exist.")
end end
@@ -232,7 +232,7 @@ function Reconciler:__applyUpdatePiece(id, visitedIds, virtualInstancesById)
return return
end 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") error("Rojo NYI: Instances with parents that weren't mentioned in an update payload")
end end

View File

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

View File

@@ -1,6 +1,7 @@
local ContentProvider = game:GetService("ContentProvider") 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 Assets = require(script.Parent.Assets)
local function preloadAssets() local function preloadAssets()
@@ -18,7 +19,7 @@ local function preloadAssets()
table.insert(contentUrls, url) table.insert(contentUrls, url)
end end
Logging.trace("Preloading assets: %s", table.concat(contentUrls, ", ")) Log.trace("Preloading assets: %s", table.concat(contentUrls, ", "))
coroutine.wrap(function() coroutine.wrap(function()
ContentProvider:PreloadAsync(contentUrls) 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. Attempts to set a property on the given instance.