When using the Log to Console action, using an expression only outputs that as literal text
See original GitHub issueDescribe the bug
Not sure if this is an issue with the SDK or Composer, so starting here.
If you use the Log to Console
action, then set the Text property to an expression, it doesn’t ever evaluate the expression. Additionally, when clicking into the Text field, it prompts/suggests that you can use an expression.
Using string interpolation works fine.
Version
1.2.1
Browser
- Electron distribution
- Chrome
- Safari
- Firefox
- Edge
OS
- macOS
- Windows
- Ubuntu
To Reproduce
Steps to reproduce the behavior:
- Add a Log Action
- Set the Text property to be a valid expression such as
=turn.activity.from.name
- Run and test, the value will only be that literal text:
=turn.activity.from.name
- String interpolation such as
${turn.activity.from.name}
works as expected/desired.
Expected behavior
Either the expression gets evaluated to the value it should be, or it should not allow/suggest to use an expression. Additionally, information tool-tip should inform this should be only text.
Screenshots
Here is the action:
"actions": [
{
"$kind": "Microsoft.LogAction",
"$designer": {
"id": "H0JjmG"
},
"label": "trace username",
"traceActivity": true,
"text": "=turn.activity.from.name"
}
]
Additional context
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Tutorial: Write a custom string interpolation handler
The compiler invokes the LogMessage method using the CoreInterpolatedStringHandler as the argument.
Read more >Template literals (Template strings) - MDN Web Docs - Mozilla
Template literals coerce their expressions directly to strings, while addition coerces its operands to primitives first.
Read more >String.raw() - JavaScript - MDN Web Docs
raw () is the only built-in template literal tag. It has close semantics to an untagged literal since it concatenates all arguments and...
Read more >Understanding Template Literals in JavaScript
When logged to the console, this will yield the following: Output. This string is using concatenation. With template literals, an expression ...
Read more >Console features reference - Chrome Developers
A comprehensive reference on every feature and behavior related to the Console UI in Chrome DevTools.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tdurnford, yes the schema needs to be changed.
LG expressions of the form
"Hello ${user.name}"
are allowed. Adaptive expressions like"=user.name"
are not allowed.I will submit a PR with the correction to the schema.
@mrivera-ms In the SDK Schema,
Microsoft.LogActions
’stext
property is a string expression. Shouldn’t it take a string or an expression that resolves to a string? Is there a difference between an expression and an LG expression - if so, we’d need a way to distinguish between the two in the SDK Schema?