grass valley developers

Home > APIs > AppServer API > Examples > Connection and System Status > Write Log Messages

Write Log Messages

Below is sample code showing how to write debug, status, warning, error, and fatal messages to the K2's log.

[C#]
// create a log
IAppServerLog log = iappServer.CreateLog(appName);

// write different message types
log.LogMsg(EntryPtMsgType.eDebugMsg, 0, "debug message");
log.LogMsg(EntryPtMsgType.eStatusMsg, 0, "status message");
log.LogMsg(EntryPtMsgType.eWarningMsg, 0, "warning message");
log.LogMsg(EntryPtMsgType.eErrorMsg, 0, "error message");
log.LogMsg(EntryPtMsgType.eFatalMsg, 0, "fatal message");
[C++]
// create a log
IAppServerLogPtr spLog;
hr = spAppServer->CreateLog(m_bstrAppName, &spLog);

// write different message types
hr = spLog->LogMsg(EntryPtMsgType_eDebugMsg, 0, _bstr_t("debug message"));
hr = spLog->LogMsg(EntryPtMsgType_eStatusMsg, 0, _bstr_t("status message"));
hr = spLog->LogMsg(EntryPtMsgType_eWarningMsg, 0, _bstr_t("warning message"));
hr = spLog->LogMsg(EntryPtMsgType_eErrorMsg, 0, _bstr_t("error message"));
hr = spLog->LogMsg(EntryPtMsgType_eFatalMsg, 0, _bstr_t("fatal message"));