Example code of logging messages - winnubstj/Gimbl GitHub Wiki
All logging is handled by a single hidden LoggerObject. Custom scripts can log messages by referencing this object using FindObjectOfType()
// Start is called before the first frame update
LoggerObject logger;
void Start()
{
// Get instance of logger.
logger = FindObjectOfType<LoggerObject>();
// send simple message.
logger.logFile.Log("Im a test message");
}
You can also log data together with a message (but this data must be JSON compatible)
public class Msg
{
public int a;
public int b;
public string c;
}
Msg msg = new Msg();
LoggerObject logger;
void Start()
{
// Get instance of logger.
logger = FindObjectOfType<LoggerObject>();
//More complex message.
msg.a = 10;
msg.b = 11;
msg.c = "AAA";
logger.logFile.Log("Im a test message",msg);
}