I can’t find out how to use the Logger in my own classes. Right now, i setup a test class that just does that:
- region usings (just copied these over from project's myNode.cs file)
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;
using System.Linq;
using System.Text;
using VVVV.Utils.VColor;
using VVVV.Utils;
using VVVV.Nodes;
using VVVV.Core.Logging;
- endregion usings
class LogTest {
public ILogger FLogger;
public void doSome(string s){
FLogger.Log(LogType.Debug,s);
}
}
which is in a separate file i added via the project manager.
It’s object lt is called from myNode’s Evaluate() like:
LogTest lt = new LogTest();
lt.doSome("HELLO");
Which would not appear in the TTY.
Of course, the FLogger in the declaration is underlined in yellow because it is never assigned anything. I tried deriving the Logger as a Constructor argument for subclasses, resulting in a red node (and ugly code).
hey tonfilm, this is quite nice new page ;] if you can add few code examples please, like for constructors and OnImportSatisfied interface, the doc is ok, but there are some stuff you can understand only with examples…
the info on constructors and OnImportsSatisfied is already available on the page plus is referencing Template (Raw) for even more details. so please tell us more precisely what infos you’re missing.
Thanks @joreg,
as i said, referring to the ILogger as a constructor argument is somewhat clumsy if you want to have the Log() command available in structures using a bunch of helper classes.
I still wonder why the TTY destination can’t just be a static method of the VVVV.Core.Logging class and thus be available throughout plugin-developer’s code?
A second thought that comes to my mind is:
Since ILogger is an interface, why can’t i just inherit it to all classes i want to use the Log() method in? #question
Sorry if this is more C# basics than vvvv-specific. Always feel free to send me to RTFM!