// Log message with no ident string at the start mDNSexport void LogMsgNoIdent(const char *format, ...) { char buffer[512]; va_list ptr; va_start(ptr,format); buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0; va_end(ptr); WriteLogMsg("", buffer, 0, LOG_INFO); }
// Log message with specified ident string at the start mDNSexport void LogMsgIdent(const char *ident, const char *format, ...) { char buffer[512]; va_list ptr; va_start(ptr,format); buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0; va_end(ptr); WriteLogMsg(ident, buffer, ident && *ident ? LOG_PID : 0); }
mDNSexport void LogMsg(const char *format, ...) { unsigned char buffer[512]; va_list ptr; va_start(ptr,format); buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0; va_end(ptr); WriteLogMsg("mDNSResponder", buffer, 0); }
mDNSlocal void LogMsgWithIdent(const char *ident, const char *format, va_list ptr) { unsigned char buffer[512]; buffer[mDNS_vsnprintf((char *)buffer, sizeof(buffer), format, ptr)] = 0; WriteLogMsg(ident, buffer, ident && *ident ? LOG_PID : 0); }
void CMessageDlg::AppendMessage(const TextMessage& msg, BOOL bStore/* = TRUE*/) { //append to message list if(bStore) m_messages.push_back(msg); //insert enter m_richHistory.SetSel(0,0); m_richHistory.ReplaceSel(_T("\r\n")); //insert msg m_richHistory.SetSel(0,0); m_richHistory.ReplaceSel( msg.szMessage ); CHARFORMAT cf; cf.cbSize = sizeof (CHARFORMAT); cf.dwMask = CFM_COLOR | CFM_UNDERLINE | CFM_BOLD; cf.dwEffects = (unsigned long)~(CFE_AUTOCOLOR | CFE_UNDERLINE | CFE_BOLD); cf.crTextColor = RGB(0, 0, 0); m_richHistory.SetSel(0, long(_tcslen(msg.szMessage))); m_richHistory.SetSelectionCharFormat(cf); //insert enter m_richHistory.SetSel(0,0); m_richHistory.ReplaceSel(_T("\r\n")); CTime tm = CTime::GetCurrentTime(); CString szTime; szTime.Format(_T("%.2d:%.2d"), tm.GetHour(), tm.GetMinute()); CString name; if(msg.nFromUserID == m_myself.nUserID) name.Format(_T("%s:"), GetDisplayName(m_myself)); else { name.Format(_T("%s:"), GetDisplayName(m_user)); } if(m_bShowTimeStamp) name = szTime + _T(" ") + name; //insert name m_richHistory.SetSel(0,0); m_richHistory.ReplaceSel(name); memset(&cf,0,sizeof (CHARFORMAT)); cf.cbSize = sizeof (CHARFORMAT); cf.dwMask = CFM_COLOR | CFM_UNDERLINE | CFM_BOLD; cf.dwEffects = CFE_UNDERLINE | CFE_BOLD; if(msg.nFromUserID == m_myself.nUserID) cf.crTextColor = RGB(0, 0, 255); else { if(m_user.uUserType & USERTYPE_ADMIN) cf.crTextColor = RGB(255, 117, 5); else cf.crTextColor = RGB(255, 0, 0); } m_richHistory.SetSel(0,name.GetLength()); m_richHistory.SetSelectionCharFormat(cf); m_richHistory.HideSelection(TRUE, FALSE); if(bStore) WriteLogMsg(m_logFile, name + msg.szMessage + _T("\r\n")); }