From f99d8670b0979f76e3c842622eb4bd0ae5b24044 Mon Sep 17 00:00:00 2001 From: EwDev <74792428+Ew-Developer@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:03:32 +0000 Subject: [PATCH 1/8] Remove trimming from element tracing Original code said there was no to specify a trace level without also specifying a message, but you can just set the message to nil to achieve this. This change makes it so we don't have to trim the traceback to remove the newline. --- src/createElement.lua | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/createElement.lua b/src/createElement.lua index 4fd6fe5a..45827b1a 100644 --- a/src/createElement.lua +++ b/src/createElement.lua @@ -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 From 50c29243b6661e481c577bffbc235836964e6f85 Mon Sep 17 00:00:00 2001 From: EwDev <74792428+Ew-Developer@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:20:18 +0000 Subject: [PATCH 2/8] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index fcc7edbf..715684da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Roact Changelog ## Unreleased Changes +* Remove trimming from element 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)) From 5fe95cea4c594cafde82fc1a1b4847a0d711b4fc Mon Sep 17 00:00:00 2001 From: EwDev <74792428+Ew-Developer@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:20:38 +0000 Subject: [PATCH 3/8] Fix update of CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 715684da..c305bc0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Roact Changelog ## Unreleased Changes -* Remove trimming from element tracing ([#387]https://github.com/Roblox/roact/pull/387) +* Remove trimming from element 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)) From 0d243c5f61fd77f1446eabefee6e2e0609b2eebe Mon Sep 17 00:00:00 2001 From: EwDev <74792428+Ew-Developer@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:26:12 +0000 Subject: [PATCH 4/8] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c305bc0e..b7892885 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ # Roact Changelog ## Unreleased Changes -* Remove trimming from element tracing ([#387](https://github.com/Roblox/roact/pull/387)) +* 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)) From b5e4cf8fc813e261afa4d2c308aac351f61cdedd Mon Sep 17 00:00:00 2001 From: EwDev <74792428+Ew-Developer@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:27:22 +0000 Subject: [PATCH 5/8] Update Logging.lua --- src/Logging.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Logging.lua b/src/Logging.lua index 13f7190e..b55f26af 100644 --- a/src/Logging.lua +++ b/src/Logging.lua @@ -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 to not add a newline + local trace = debug.traceback(nil, 2) local fullMessage = ("%s\n%s"):format(message, indent(trace, 1)) if outputEnabled then From 9db11d8a6d35e905aea571d7cbe00f458a9ebf16 Mon Sep 17 00:00:00 2001 From: EwDev <74792428+Ew-Developer@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:28:19 +0000 Subject: [PATCH 6/8] Update Logging.lua --- src/Logging.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Logging.lua b/src/Logging.lua index b55f26af..ac6ec550 100644 --- a/src/Logging.lua +++ b/src/Logging.lua @@ -129,7 +129,7 @@ function Logging.warn(messageTemplate, ...) table.insert(collector.warnings, message) end - -- set message to nil to not add a newline + -- Set message to nil to not add a newline. local trace = debug.traceback(nil, 2) local fullMessage = ("%s\n%s"):format(message, indent(trace, 1)) From 5f01adf7ccd6f17c2dc73f7ff5e745a49af3a9f2 Mon Sep 17 00:00:00 2001 From: EwDev <74792428+Ew-Developer@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:29:03 +0000 Subject: [PATCH 7/8] Update Logging.lua --- src/Logging.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Logging.lua b/src/Logging.lua index ac6ec550..e706c1dc 100644 --- a/src/Logging.lua +++ b/src/Logging.lua @@ -129,7 +129,7 @@ function Logging.warn(messageTemplate, ...) table.insert(collector.warnings, message) end - -- Set message to nil to not add a newline. + -- Set message to nil to so a newline doesn't get added. local trace = debug.traceback(nil, 2) local fullMessage = ("%s\n%s"):format(message, indent(trace, 1)) From ab14a2cbb0e353663d7988b27da2b9ba87978c50 Mon Sep 17 00:00:00 2001 From: EwDev <74792428+Ew-Developer@users.noreply.github.com> Date: Sat, 17 Jun 2023 19:42:23 +0000 Subject: [PATCH 8/8] Update Logging.lua --- src/Logging.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Logging.lua b/src/Logging.lua index e706c1dc..544b150d 100644 --- a/src/Logging.lua +++ b/src/Logging.lua @@ -129,7 +129,7 @@ function Logging.warn(messageTemplate, ...) table.insert(collector.warnings, message) end - -- Set message to nil to so a newline doesn't get added. + -- 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))