Skip to content
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

Redirect debug print to "Output Log" #61

Closed
peterpeterparker opened this issue Jul 22, 2021 · 4 comments
Closed

Redirect debug print to "Output Log" #61

peterpeterparker opened this issue Jul 22, 2021 · 4 comments

Comments

@peterpeterparker
Copy link
Member

Feature Description

It may be a mistake on my side but, it seems that debug outputs are not redirected to the "Output Log" pane. I think it would would be quite handy.

Sample

import Debug "mo:base/Debug";

actor HelloWorld {

  public func print() {
    Debug.print("Hello World!");
  };
  
};

Screenshot

Capture d’écran 2021-07-22 à 09 30 40

@chenyan-dfinity
Copy link
Contributor

That's an expected behavior. Debug.print only prints to the replica log (you can only see it in the dfx start terminal when you run locally). It's never visible on the IC.

To see the result on Candid UI, you can return the text, e.g.,

public func print() : async Text {
  "Hello world!"
};

@peterpeterparker
Copy link
Member Author

Yeah, that's why I provided it as a "Feature request" or "idea" if you rather like. I think from a user perspective of the playground it would be helpful to get these logs in the playground too.

@chenyan-dfinity
Copy link
Contributor

Okay. I can see two ways to solve this problem. Let me know which is closer to your feature request.

  1. We can add an interpreter or WASI mode in the playground. In there, we can easily output Debug.print into the UI. The limitation is that you cannot deploy this to the IC. Integrate interpreter and WASI mode into playground #49 is the tracking issue.
  2. Before you deploy the Wasm to IC, we replace Debug.print to an inter-canister call to the playground frontend, so that it can print the result.

@peterpeterparker
Copy link
Member Author

Thanks for the suggestions.

  1. is probably the closest to what I have in mind but, just my two cents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants