question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When using the Log to Console action, using an expression only outputs that as literal text

See original GitHub issue

Describe 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.

image

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:

  1. Add a Log Action
  2. Set the Text property to be a valid expression such as =turn.activity.from.name
  3. Run and test, the value will only be that literal text: =turn.activity.from.name
  4. 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

console_log_1

console_log_2

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:closed
  • Created 3 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
mrivera-mscommented, Dec 8, 2020

@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.

0reactions
tdurnfordcommented, Dec 7, 2020

@mrivera-ms In the SDK Schema, Microsoft.LogActions’s text 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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found