With `enableDebug: true` nothing gets logged to AppInsights when message exceeds max length
See original GitHub issueContext: We would like to use enableDebug: true
for local development, but the current behavior is a blocker for this practice.
Current behavior:
When the message exceeds the maximum allowed length, it will be truncated by AppInsights
, but nothing will be logged when enableDebug: true
, because the throwInternal
called just after will throw, and also, the whole execution flow will be broken by the throw.
Expected behavior:
Message truncation should be treated specially and never throw (so, it should not looking at the enableDebug
flag), but only log a warning to the console (or ApplicationInsights-JS
could consider changing it to console.error
when enableDebug: true
).
Rationale: Most of the time, it’s unreasonable to tell developers to add, to otherwise very simple business logic, a noisy concern for selecting only useful information from the error and ensuring it doesn’t exceed the maximum. Especially when the error was thrown from a 3rd party. Relying on the messages being truncated automatically for AppInsights, while logged full to the console, is often really good enough.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top GitHub Comments
Thanks for the feedback @slawomir-brzezinski-at-clarksons, I will definitely update the docs to clarify this!
Thank you for swift response @markwolff . If I understand correctly, the flag only exists in the beta version of the API, which actually didn’t notice yet. We will switch to it in due course.
Going back to the our goal of a setting for local development, I suppose then that the
enableDebug
flag will stay as is, so it seems to me that it’s not really useful to users of the library. As such, perhaps it should not be advertised as a public part of the API? In any case, it would be good if documentation made it clear what is the desired setting for outside of production, especially developer machines.Thanks again!