-
-
Notifications
You must be signed in to change notification settings - Fork 171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added more details in logger LWC's console statements #789
Conversation
@jamessimone if you have some time this week, I'd love to get your thoughts on these changes. I sent you an early preview of some of it a few days ago, but I've made several more tweaks to the output since then. |
…'s printed using console statements The stringified object now includes more details, such as the exception and tags Calling the console function now happens with a delay (using setTimeout()) so that additional details can be added to the log entry (using the builder methods) before the log entry is stringified & printed out
5d0a72b
to
711f81c
Compare
…messimone for the suggestion!), and updated some Jest asserts to match the updated output of some console statements
711f81c
to
9aef5ba
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #789 +/- ##
==========================================
- Coverage 94.21% 92.72% -1.50%
==========================================
Files 58 75 +17
Lines 5964 7283 +1319
Branches 0 200 +200
==========================================
+ Hits 5619 6753 +1134
- Misses 345 510 +165
- Partials 0 20 +20
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
When using the
logger
LWC and JavaScript console logging is enabled (viaLoggerSettings__c.IsJavaScriptConsoleLoggingEnabled__c
), Nebula Logger automatically calls functions in the browser'sconsole
so devs can easily see the generated log entry directly in their browser (instead of having to find it inLogEntry__c
). This PR improves the component log entry JSON that's printed usingconsole
statements - the stringified object now includes more details, such as details about the logged error/exception (when an error is logged), any tags added to the entry, and the user's localized version of the entry'stimestamp
.console
functions: now,console
functions are called with a 1 second delay (usingsetTimeout()
) so that additional details can be added to the log entry (using the builder methods) before the log entry is stringified & printed out. This may not be a perfect solution, but seems to work in most cases of using the JS builder methods.To show the difference in the changes, this JavaScript was used to generate some example log entries:
In the screenshot below, 2 versions of the output are shown:
setExceptionDetails()
.console
statements' outputconsole
output. This keeps the output slimmer & easier to read.new Date().toISOString()
) and in the user's local format (usingnew Date().toLocaleString()
). This makes it a little easier for devs to troubleshoot exactly when an entry was generated in their browser.