Update logging and enhance .gitignore for Atlas directory

- Introduced a logging system using `tracing` and related crates to improve log management and output formatting.
- Updated `.gitignore` to include the `.atlas/` directory, ensuring that log files and other generated content are not tracked by Git.
- Enhanced project templates to include the new `.gitignore` settings for Atlas in various project types.

These changes aim to improve logging capabilities and maintain a cleaner repository by ignoring unnecessary files.
This commit is contained in:
Joe 2026-03-01 13:16:00 -06:00
parent b5583c4c1b
commit 3fd50df0b2
29 changed files with 1463 additions and 79 deletions

View file

@ -6,6 +6,7 @@ local Packages = Rojo.Packages
local Log = require(Packages.Log)
local Config = require(script.Parent.Config)
local ConsoleOutput = require(script.Parent.McpTools.Utils.ConsoleOutput)
local strict = require(script.Parent.strict)
local RECONNECT_INTERVAL = 5
@ -62,6 +63,7 @@ function McpStream:stop()
end
function McpStream:_disconnect()
ConsoleOutput.onLogMessage = nil
if self._wsClient then
pcall(function()
self._wsClient:Destroy()
@ -95,6 +97,19 @@ function McpStream:_tryConnect()
wsClient:Send(greeting)
end)
ConsoleOutput.onLogMessage = function(message: string, messageType: Enum.MessageType)
if not self._wsClient then
return
end
pcall(function()
self._wsClient:Send(HttpService:JSONEncode({
type = "roblox_log",
message = message,
level = messageType.Value,
}))
end)
end
local done = false
local closed, errored, received
@ -195,6 +210,7 @@ function McpStream:_tryConnect()
closed = wsClient.Closed:Connect(function()
done = true
ConsoleOutput.onLogMessage = nil
closed:Disconnect()
errored:Disconnect()
received:Disconnect()
@ -203,6 +219,7 @@ function McpStream:_tryConnect()
errored = wsClient.Error:Connect(function(_code, _msg)
done = true
ConsoleOutput.onLogMessage = nil
closed:Disconnect()
errored:Disconnect()
received:Disconnect()

View file

@ -6,10 +6,11 @@ local MAX_OUTPUT = 10000
local ConsoleOutput = {
outputMessage = "",
onLogMessage = nil :: ((message: string, messageType: Enum.MessageType) -> ())?,
}
function ConsoleOutput.startListener(): RBXScriptConnection
local conn = LogService.MessageOut:Connect(function(message: string, _: Enum.MessageType)
local conn = LogService.MessageOut:Connect(function(message: string, messageType: Enum.MessageType)
if #ConsoleOutput.outputMessage + #message <= MAX_OUTPUT then
if #ConsoleOutput.outputMessage == 0 then
ConsoleOutput.outputMessage = message
@ -17,6 +18,11 @@ function ConsoleOutput.startListener(): RBXScriptConnection
ConsoleOutput.outputMessage = ConsoleOutput.outputMessage .. "\n" .. message
end
end
local callback = ConsoleOutput.onLogMessage
if callback then
callback(message, messageType)
end
end)
return conn
end