Console.WriteLine()

Have been making use of Dynamo’s watch function to view console string return messages.

After trying to implement ZeroTouchLibrary dynamo custom packages, realised that it has become much harder to obtain logs.

Especially so since the functions that am trying to implement are asynchronous in nature.

Is there anyway we can make use of the Dynamo’s console window to print messages?

How does one go about printing console messages logged from package C scripts.

using System.Windows.Forms;

string buffer = “hello there friends :)”;

MessageBox.Show("buffer message is " + buffer);

Realised that the windows messagebox alert is a good way at least to debug async console messages in dynamo. Hope this helps!

You need to create a class in your assembly that inherits from the Dynamo.Logging.ILogSource interface and add the necessary methods from it. Dynamo will then detect that and forward the logged messages to the console (Ctrl + Shift + UpArrow)

public class ExecutionExtension : IExtension, ILogSource
    {
        #region ILogSource implementation

        public event Action<ILogMessage> MessageLogged;

        private void Log(ILogMessage obj)
        {
            if (MessageLogged != null)
            {
                MessageLogged(obj);
            }
        }

        private void Log(string message)
        {
            Log(LogMessage.Info(message));
        }
       #endregion
        ...
6 Likes