Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Remove trimming from tracing #387

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Roact Changelog

## Unreleased Changes
* Remove trimming from tracing ([#387](https://github.com/Roblox/roact/pull/387))

## [1.4.4](https://github.com/Roblox/roact/releases/tag/v1.4.4) (June 13th, 2022)
* Added Luau analysis to the repository ([#372](https://github.com/Roblox/roact/pull/372))
Expand Down
4 changes: 2 additions & 2 deletions src/Logging.lua
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ function Logging.warn(messageTemplate, ...)
table.insert(collector.warnings, message)
end

-- debug.traceback inserts a leading newline, so we trim it here
local trace = debug.traceback("", 2):sub(2)
-- Set message to nil so a newline doesn't get added.
local trace = debug.traceback(nil, 2)
local fullMessage = ("%s\n%s"):format(message, indent(trace, 1))

if outputEnabled then
Expand Down
5 changes: 2 additions & 3 deletions src/createElement.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ local function createElement(component, props, children)
}

if config.elementTracing then
-- We trim out the leading newline since there's no way to specify the
-- trace level without also specifying a message.
element.source = debug.traceback("", 2):sub(2)
-- We set the message to nil to prevent the newline from appearing.
element.source = debug.traceback(nil, 2)
end

return element
Expand Down